<?php
/**
*
* @author Blackpawn blackpawn666@hotmail.com - http://blackpawnsarchives.net
* @co_author GameCharmer admin@gamecharmer.com - http://gaming.gamecharmer.com
* @package Age of Dragons Mod :: ( Game Console Required )
* @version $Id: admincp.php 1.1.1 12-26-2009 Blackpawn
* @copyright (c) 2009 Blackpawns Archives
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
* @ignore
*/

define('GC_MOD', true);
define('IN_PHPBB', true);
define('AOD', true);

$phpbb_root_path =  '../../';
$templates_path = '../../../games/aod/templates/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);

include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/functions_admin.' . $phpEx);
include($phpbb_root_path . 'includes/mods/game_console/gc_common.' . $phpEx);
include($phpbb_root_path . 'games/aod/common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

// Set custom language path
$user->set_custom_lang_path($phpbb_root_path.'games/aod/language/');

//load our language file
$user->add_lang('common');

// Now add the phpBB language path
$user->set_custom_lang_path($phpbb_root_path . 'language');

// Load the Game Console language file
$user->add_lang('mods/game_console');

if ($user->data['user_id'] == ANONYMOUS)
{
	login_box('', $user->lang['LOGIN']);
}

if ($user->data['is_bot'])
{
	redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
}

// Var Requests
$admin_page = TRUE; // Highlights the admin tab
$user_id = $user->data['user_id'];
$cmd = request_var('cmd','');
$menu = request_var('menu',0);
$news = request_var('news','');
$nid = request_var('nid',0);
$cron_passwd = request_var('cron_passwd','');
$land_gold = request_var('land_gold',0);
$sponsor_def_bonus = request_var('sponsor_def_bonus',0.00);
$farms_income_min = request_var('farms_income_min',0);
$farms_income_max = request_var('farms_income_max',0);
$timber_mills_income_min = request_var('timber_mills_income_min',0);
$timber_mills_income_max = request_var('timber_mills_income_max',0);
$iron_mines_income_min = request_var('iron_mines_income_min',0);
$iron_mines_income_max = request_var('iron_mines_income_max',0);
$gold_mines_income_min = request_var('gold_mines_income_min',0);
$gold_mines_income_max = request_var('gold_mines_income_max',0);
$food_per_gold = request_var('food_per_gold',0);
$wood_per_gold = request_var('wood_per_gold',0);
$iron_per_gold = request_var('iron_per_gold',0);
$granaries_max = request_var('granaries_max',0);
$woodsheds_max = request_var('woodsheds_max',0);
$ironpits_max = request_var('ironpits_max',0);
$vaults_max = request_var('vaults_max',0);
$start_farms = request_var('start_farms',0);
$start_timbermills = request_var('start_timbermills',0);
$start_ironmines = request_var('start_ironmines',0);
$start_goldmines = request_var('start_goldmines',0);
$start_granaries = request_var('start_granaries',0);
$start_woodsheds = request_var('start_woodsheds',0);
$start_ironpits = request_var('start_ironpits',0);
$start_vaults = request_var('start_vaults',0);
$stamina_advantage = request_var('stamina_advantage',0);
$turns_advantage = request_var('turns_advantage',0);
$unitcost_advantage = request_var('unitcost_advantage',0.00);
$offdef_advantage = request_var('offdef_advantage',0.00);
$kingdoms_per_page = request_var('kingdoms_per_page',0);
$quests_per_page = request_var('quests_per_page',0);
$ranks_per_page = request_var('ranks_per_page',0);
$reports_per_page = request_var('reports_per_page',0);
$land_cost_penalty = request_var('land_cost_penalty',0.00);
$unit_cost_penalty = request_var('unit_cost_penalty',0.00);
$uid = request_var('uid',0);
$qid = request_var('qid',0);
$building_id = request_var('building_id',0);
$unit_id = request_var('unit_id' , 0);
$market_open = request_var('market_open' , 0);
$shop_open = request_var('shop_open' , 0);
$exp_for_bash = request_var('exp_for_bash' , 0);
$times_greater = request_var('times_greater' , 0);
$land_greater = request_var('land_greater' , 0);
$net_greater = request_var('net_greater' , 0);
$levels_greater = request_var('levels_greater' , 0);
$bash_penalty = request_var('bash_penalty' , 0);

					
// Default Vars
$admin = 0;
$error_msgs = null;

// Gather some user info
$user_id = $user->data['user_id'];
$account_status = gc_check_account_status($user_id,$game_id);
$king = fetch_kingdom_data($user_id);
$admin_access = $king['admin_access'];
$kingdom_status = $king['kingdom_status'];

// Check to see if this user is a admin staff member
if ($user_id == 2 || $admin_access == 1)
{
	$admin = 1;
}else{
	trigger_error($user->lang['ADMIN_AREA_ONLY'].back_link());
}

// Check kingdom status to see if this account is frozen
if($kingdom_status == 1)
{
	// Lets make sure the main admin can't be blocked
	if ($user_id <> 2){
		trigger_error($user->lang['FROZEN'] . back_link());
	}
}

// Build ACP Pages
switch($menu)
{
	case 11:
		$rid = request_var('rid', 0);

		if($cmd == $user->lang['ADD'])
		{
			$sql_ary = array(
				'resource' 			=> request_var('resource', ''),
				'cost' 				=> request_var('cost', 0),
				'kingdom_field' 	=> request_var('kingdom_field', ''),
				'kingdom_max_field' => request_var('kingdom_max_field', ''),
				'amount_offset' 	=> request_var('amount_offset', 0),
				'operator' 			=> request_var('operator', 0),				
				'maxout' 			=> request_var('maxout', 0),
			);
			shop_add_resource($sql_ary);
			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=11").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['SHOP_CONFIG_ADD'].$return_link);				
		}
						
		if($cmd == $user->lang['UPDATE'])
		{
			$sql_ary = array(
				'resource' 			=> request_var('resource', ''),
				'cost' 				=> request_var('cost', 0),
				'kingdom_field' 	=> request_var('kingdom_field', ''),
				'kingdom_max_field' => request_var('kingdom_max_field', ''),
				'amount_offset' 	=> request_var('amount_offset', 0),
				'operator' 			=> request_var('operator', 0),				
				'maxout' 			=> request_var('maxout', 0),
			);
			
			$db->sql_query('UPDATE ' . AOD_SHOP_TABLE .' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE id = $rid");
			$db->sql_return_on_error(false);					

			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=11").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['SHOP_CONFIG_UPDATE'].$return_link);	
		}

		if($cmd == $user->lang['DELETE']){
			if($rid)
			{
				$s_hidden_fields = build_hidden_fields(array(
					'cmd' => 'delete_confirmed',
					'rid' => $rid,
					)
				);
		
				//Display confirm box
				confirm_box(false, $user->lang['CONFIRM_S_RESOURCE_DELETE'], $s_hidden_fields);	
			}			
		}
		
		if($cmd == 'delete_confirmed'){
			if (confirm_box(true))				
			{		
				// Remove the selected quest
				delete_shop_resource($rid);

				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=11").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['S_RESOURCE_DELETED_SUCCESSFULLY'].$return_link);	
			}else{
				redirect(append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=11"));
			}		
		}
				
		$build_field_option_list = build_field_option_list();

		$acp_control_data .= '<br />
		<form method="post">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="98%" class="game_panel">
			<tr>
				<td class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_11'].' - '.$user->lang['ADD_NEW_RESOURCE'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="left"><span class="stext">
					<input type="text" name="resource" class="game_post" maxlength="75" value=""> '.$user->lang['RESOURCE_NAME'].'<br />
					<input type="text" name="cost" class="game_post" maxlength="12" value="0"> '.$user->lang['COST_OF_RESOURCE'].'<br />
					
					<select name="kingdom_field" class="game_post">
					'.$build_field_option_list.'
					</select> '.$user->lang['KINGDOM_FIELD'].'<br />

					<select name="kingdom_max_field" class="game_post">
					'.'<option value=""></option>'.$build_field_option_list.'
					</select> '.$user->lang['KINGDOM_FIELD_MAX'].'<br />
					
					<input type="text" name="amount_offset" class="game_post" maxlength="12" value="0"> '.$user->lang['OFFSET_AMOUNT'].'<br />
					
					<select name="operator" class="game_post">
						<option value="0">+</option>
						<option value="1">-</option>							
					</select> '.$user->lang['OPERATOR'].'<br />
					
					<select name="maxout" class="game_post">
						<option value="0">'.$user->lang['NO'].'</option>
						<option value="1">'.$user->lang['YES'].'</option>
					</select> '.$user->lang['MAXING_OUT'].'<br /><br />							
					
					<input type="submit" name="cmd" value="'.$user->lang['ADD'].'" class="game_post">
					
					</span>
				</td>
			</tr>
			
		</table>
		<br />
		</form>';


			$sql = "SELECT *
			FROM " . AOD_SHOP_TABLE . "	
			ORDER BY id ASC";
			$result = $db->sql_query($sql);
						
			while ($row = $db->sql_fetchrow($result))
			{
			
				$rid = $row['id'];
				$resource = $row['resource'];
				$cost = $row['cost'];
				$kingdom_field = $row['kingdom_field'];
				$kingdom_max_field = $row['kingdom_max_field'];
				$amount_offset = $row['amount_offset'];

				$operator = $row['operator'];
				$maxout_selected = NULL;
				
				if($operator == TRUE)
				{
					$operator_selected = 'SELECTED';
				}
					
				$maxout = $row['maxout'];
				$maxout_selected = NULL;
				
				if($maxout == TRUE)
				{
					$maxout_selected = 'SELECTED';
				}
				
				$acp_control_data .= '
				<form method="post">
				<input type="hidden" name="rid" value="'.$rid.'">
				<table border="0" cellspacing="0" cellpadding="4" align="center" width="98%" class="game_panel">
					<tr>
						<td class="game_header" align="center"><span class="ntext"><b>'.$resource.'</b></span></td>
					</tr>
					<tr>
						<td class="game_row3" align="left">
							<span class="stext">
							<input type="text" name="resource" class="game_post" maxlength="75" value="'.$resource.'"> '.$user->lang['RESOURCE_NAME'].'<br />
							<input type="text" name="cost" class="game_post" maxlength="12" value="'.$cost.'"> '.$user->lang['COST_OF_RESOURCE'].'<br />
							
							<select name="kingdom_field" class="game_post">
							'.'<option value="'.$kingdom_field.'">'.$kingdom_field.'</option><option value="">---------------------------</option>'.$build_field_option_list.'
							</select> '.$user->lang['KINGDOM_FIELD_MAX'].' '.$user->lang['KINGDOM_FIELD'].'<br />
														
							<select name="kingdom_max_field" class="game_post">
							'.'<option value="'.$kingdom_max_field.'">'.$kingdom_max_field.'</option><option value="">---------------------------</option>'.$build_field_option_list.'
							</select> '.$user->lang['KINGDOM_FIELD_MAX'].' '.$user->lang['KINGDOM_FIELD_MAX'].'<br />
							
							<input type="text" name="amount_offset" class="game_post" maxlength="12" value="'.$amount_offset.'"> '.$user->lang['OFFSET_AMOUNT'].'<br />
							
							<select name="operator" class="game_post">
								<option value="0" >+</option>
								<option value="1" '.$maxout_selected.'>-</option>							
							</select> '.$user->lang['OPERATOR'].'<br />
							
							<select name="maxout" class="game_post">
								<option value="0" >'.$user->lang['NO'].'</option>
								<option value="1" '.$maxout_selected.'>'.$user->lang['YES'].'</option>
							</select> '.$user->lang['MAXING_OUT'].'<br /><br />							
							
							<input type="submit" name="cmd" value="'.$user->lang['UPDATE'].'" class="game_post"> <input type="submit" name="cmd" value="'.$user->lang['DELETE'].'" class="game_post">
							
							</span>
						</td>
					</tr>
					
				</table>
				<br />
				</form>';	
			}	
			$db->sql_freeresult($result);
			
	break;
	
	case 10:
		$rid = request_var('rid', 0);

		if($cmd == $user->lang['ADD'])
		{
			$sql_ary = array(
				'resource' 			=> request_var('resource', ''),
				'cost' 				=> request_var('cost', 0),
				'kingdom_field' 	=> request_var('kingdom_field', ''),
				'kingdom_max_field' => request_var('kingdom_max_field', ''),
				'amount_offset' 	=> request_var('amount_offset', 0),
				'operator' 			=> request_var('operator', 0),				
				'maxout' 			=> request_var('maxout', 0),
			);
			bm_add_resource($sql_ary);
			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=10").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['BLACKMARKET_CONFIG_ADD'].$return_link);				
		}
		
		if($cmd == $user->lang['UPDATE'])
		{
			$sql_ary = array(
				'resource' 			=> request_var('resource', ''),
				'cost' 				=> request_var('cost', 0),
				'kingdom_field' 	=> request_var('kingdom_field', ''),
				'kingdom_max_field' => request_var('kingdom_max_field', ''),
				'amount_offset' 	=> request_var('amount_offset', 0),
				'operator' 			=> request_var('operator', 0),				
				'maxout' 			=> request_var('maxout', 0),
			);
			
			
			$db->sql_query('UPDATE ' . AOD_BLACKMARKET_TABLE .' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE id = $rid");
			$db->sql_return_on_error(false);					

			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=10").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['BLACKMARKET_CONFIG_UPDATE'].$return_link);	
		}

		if($cmd == $user->lang['DELETE']){
			if($rid)
			{
				$s_hidden_fields = build_hidden_fields(array(
					'cmd' => 'delete_confirmed',
					'rid' => $rid,
					)
				);
		
				//Display confirm box
				confirm_box(false, $user->lang['CONFIRM_BM_RESOURCE_DELETE'], $s_hidden_fields);	
			}			
		}
		
		if($cmd == 'delete_confirmed'){
			if (confirm_box(true))				
			{		
				// Remove the selected quest
				delete_bm_resource($rid);

				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=10").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['BM_RESOURCE_DELETED_SUCCESSFULLY'].$return_link);	
			}else{
				redirect(append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=10"));
			}		
		}
					
		$build_field_option_list = build_field_option_list();
		

		$acp_control_data .= '<br />
		<form method="post">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="98%" class="game_panel">
			<tr>
				<td class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_10'].' - '.$user->lang['ADD_NEW_RESOURCE'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="left"><span class="stext">
					<input type="text" name="resource" class="game_post" maxlength="75" value=""> '.$user->lang['RESOURCE_NAME'].'<br />
					<input type="text" name="cost" class="game_post" maxlength="12" value="0"> '.$user->lang['COST_OF_RESOURCE'].'<br />
					
					<select name="kingdom_field" class="game_post">
					'.$build_field_option_list.'
					</select> '.$user->lang['KINGDOM_FIELD'].'<br />

					<select name="kingdom_max_field" class="game_post">
					'.'<option></option>'.$build_field_option_list.'
					</select> '.$user->lang['KINGDOM_FIELD_MAX'].'<br />
					
					<input type="text" name="amount_offset" class="game_post" maxlength="12" value="0"> '.$user->lang['OFFSET_AMOUNT'].'<br />
					
					<select name="operator" class="game_post">
						<option value="0">+</option>
						<option value="1">-</option>							
					</select> '.$user->lang['OPERATOR'].'<br />
					
					<select name="maxout" class="game_post">
						<option value="0">'.$user->lang['NO'].'</option>
						<option value="1">'.$user->lang['YES'].'</option>
					</select> '.$user->lang['MAXING_OUT'].'<br /><br />							
					<input type="submit" name="cmd" value="'.$user->lang['ADD'].'" class="game_post">
					</span>
				</td>
			</tr>
			
		</table>
		<br />
		</form>';


			$sql = "SELECT *
			FROM " . AOD_BLACKMARKET_TABLE . "	
			ORDER BY id ASC";
			$result = $db->sql_query($sql);
						
			while ($row = $db->sql_fetchrow($result))
			{
			
				$rid = $row['id'];
				$resource = $row['resource'];
				$cost = $row['cost'];
				$kingdom_field = $row['kingdom_field'];
				$kingdom_max_field = $row['kingdom_max_field'];
				$amount_offset = $row['amount_offset'];

				$operator = $row['operator'];
				$operator_selected = NULL;
				
				if($operator == TRUE)
				{
					$operator_selected = 'SELECTED';
				}
					
				$maxout = $row['maxout'];
				$maxout_selected = NULL;
				
				if($maxout == TRUE)
				{
					$maxout_selected = 'SELECTED';
				}
				
				$acp_control_data .= '
				<form method="post">
				<input type="hidden" name="rid" value="'.$rid.'">
				<table border="0" cellspacing="0" cellpadding="4" align="center" width="98%" class="game_panel">
					<tr>
						<td class="game_header" align="center"><span class="ntext"><b>'.$resource.'</b></span></td>
					</tr>
					<tr>
						<td class="game_row3" align="left">
							<span class="stext">
							<input type="text" name="resource" class="game_post" maxlength="75" value="'.$resource.'"> '.$user->lang['RESOURCE_NAME'].'<br />
							<input type="text" name="cost" class="game_post" maxlength="12" value="'.$cost.'"> '.$user->lang['COST_OF_RESOURCE'].'<br />

							<select name="kingdom_field" class="game_post">
							'.'<option value="'.$kingdom_field.'">'.$kingdom_field.'</option><option value="">---------------------------</option>'.$build_field_option_list.'
							</select> '.$user->lang['KINGDOM_FIELD_MAX'].' '.$user->lang['KINGDOM_FIELD'].'<br />
														
							<select name="kingdom_max_field" class="game_post">
							'.'<option value="'.$kingdom_max_field.'">'.$kingdom_max_field.'</option><option value="">---------------------------</option>'.$build_field_option_list.'
							</select> '.$user->lang['KINGDOM_FIELD_MAX'].' '.$user->lang['KINGDOM_FIELD_MAX'].'<br />

							<input type="text" name="amount_offset" class="game_post" maxlength="12" value="'.$amount_offset.'"> '.$user->lang['OFFSET_AMOUNT'].'<br />

							<select name="operator" class="game_post">
								<option value="0" >+</option>
								<option value="1" '.$maxout_selected.'>-</option>							
							</select> '.$user->lang['OPERATOR'].'<br />
							
							<select name="maxout" class="game_post">
								<option value="0" >'.$user->lang['NO'].'</option>
								<option value="1" '.$maxout_selected.'>'.$user->lang['YES'].'</option>
							</select> '.$user->lang['MAXING_OUT'].'<br /><br />							
							
							<input type="submit" name="cmd" value="'.$user->lang['UPDATE'].'" class="game_post"> <input type="submit" name="cmd" value="'.$user->lang['DELETE'].'" class="game_post">
							
							</span>
						</td>
					</tr>
					
				</table>
				<br />
				</form>';	
			}	
			$db->sql_freeresult($result);
	break;
	
	case 9:
		// Variables
		$installed_version = null;
		$errstr = null;
		$errno = 0;
		$info = null;
		$latest_version = null;
		$update_url = null;
		$update_link = null;
		
		$gid = gc_fetch_gid('aod');
		$gdata = gc_fetch_game_data($gid);

		$installed_version = $gdata['ver_major'].'.'.$gdata['ver_minor'].'.'.$gdata['ver_build'];
		$info = get_remote_file('www.blackpawnsarchives.net', '/software/fw/ver/', 'aod.txt' , $errstr, $errno);
		
		if ($info === false)
		{
			trigger_error($errstr, E_USER_WARNING);
		}

		$info = explode("\n", $info);
		$latest_version = trim($info[0]);

		$update_url = trim($info[1]);


		if(isset($update_url)){
			$update_link = sprintf($user->lang['UPDATE_LINK'],$update_url);
		}else{
			$update_link = sprintf($user->lang['UPDATE_LINK'],'http://blackpawnsarchives.net');
		}

		
		$acp_control_data = '<br /><br />
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="50%" class="game_panel">
			<tr>
				<td class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_9'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="left" style="padding-left:15px;padding-right:15px;">
					<span class="stext">
						<b>'.$user->lang['INSTALLED_VERSION'].' :</b> '.$installed_version.'<br />
						<b>'.$user->lang['LATEST_VERSION'].' :</b> '.$latest_version.'<br />
						<hr>';
						
		if($installed_version != $latest_version){			
			$acp_control_data .= $update_link;
		}else{
			$acp_control_data .= '<span class="ntextgreen">'.$user->lang['VERSION_UP_TO_DATE'].'</span>';		
		}
		
							
		$acp_control_data .= '<br /><br />
					</span>
				</td>
			</tr>
		</table><br />';
	break;
	case 8:

	if(!$unit_id){
		
		$unit_option_list = build_unit_option_list();
		
		$acp_control_data = '
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_8'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="right" width="25%" ><span class="stext"><b>'.$user->lang['UNITS'].' :</b></span></td>
				<td class="game_row3" align="center" width="75%" ><select name="unit_id" class="game_post">'.$unit_option_list.'</select></td>
			</tr>		
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['SELECT'].'"></td>
			</tr>
		</table><br />';
		
	}else{		

		// Update Building Config
		if($cmd == $user->lang['UPDATE'])
		{
			$sql_ary = array(
				'unit_name' 	=> request_var('unit_name', ''),
				'unit_net' 		=> request_var('unit_net', 0),
				'unit_off' 		=> request_var('unit_off', 0),
				'unit_def' 		=> request_var('unit_def', 0),
				'unit_gold' 	=> request_var('unit_gold', 0),
				'unit_food' 	=> request_var('unit_food', 0),				
				'unit_wood' 	=> request_var('unit_wood', 0),
				'unit_iron' 	=> request_var('unit_iron', 0),
				'unit_level' 	=> request_var('unit_level', 0),

			);
			
			$db->sql_query('UPDATE ' . AOD_UNITS_TABLE .' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE id = $unit_id");
			$db->sql_return_on_error(false);					

			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=8").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['KINGDOM_CONFIG_UPDATE'].$return_link);	
		}
		
		$udata = fetch_unit_data($unit_id);
		if($udata['unit_level'] == -1)
		{
			$readonly = 'readonly';
		}else{
			$readonly = NULL;
		}	
							
		$acp_control_data = '
		<input type="hidden" name="unit_id" value="'.$unit_id.'">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_8'].'</b></span></td>
			</tr>
			<tr>';
			
		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" width="80%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['NAME'].'</b></span></td>
				<td class="game_row3" align="center" width="20%"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_name" class="game_post" maxlength="32" value="'.$udata['unit_name'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left"  style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['NETWORTH'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_net" class="game_post" maxlength="10" value="'.$udata['unit_net'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_OFFENSE'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_off" class="game_post" maxlength="10" value="'.$udata['unit_off'].'" '.$readonly.'></td>
			</tr>';
			
		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_DEFENSE'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_def" class="game_post" maxlength="10" value="'.$udata['unit_def'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_GOLD'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_gold" class="game_post" maxlength="10" value="'.$udata['unit_gold'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_FOOD'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_food" class="game_post" maxlength="10" value="'.$udata['unit_food'].'" '.$readonly.'></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_WOOD'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_wood" class="game_post" maxlength="10" value="'.$udata['unit_wood'].'" '.$readonly.'></td>
			</tr>';


		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left"  style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_IRON'].'</b></span></td>
				<td class="game_row3" align="center"   style="border-bottom:solid thin #000000;"><input type="text" name="unit_iron" class="game_post" maxlength="10" value="'.$udata['unit_iron'].'" '.$readonly.'></td>
			</tr>';		


		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNIT_LEVEL'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="unit_level" class="game_post" maxlength="10" value="'.$udata['unit_level'].'" '.$readonly.'></td>
			</tr>';
			
		$acp_control_data .= '
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['UPDATE'].'"></td>
			</tr>				
		</table>';	
	}	
	break;
		
	case 7:

	if(!$building_id){
		
		$building_option_list = build_building_option_list();
		
		$acp_control_data = '
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_7'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="right" width="25%" ><span class="stext"><b>'.$user->lang['BUILDINGS'].' :</b></span></td>
				<td class="game_row3" align="center" width="75%" ><select name="building_id" class="game_post">'.$building_option_list.'</select></td>
			</tr>		
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['SELECT'].'"></td>
			</tr>
		</table><br />';
		
	}else{		

		// Update Building Config
		if($cmd == $user->lang['UPDATE'])
		{
			$sql_ary = array(
				'building_name' 	=> request_var('building_name', ''),
				'building_net' 		=> request_var('building_net', 0),
				'building_def' 		=> request_var('building_def', 0),
				'building_gold' 	=> request_var('building_gold', 0),
				'building_wood' 	=> request_var('building_wood', 0),
				'building_iron' 	=> request_var('building_iron', 0),
			);
			
			$db->sql_query('UPDATE ' . AOD_BUILDINGS_TABLE .' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE id = $building_id");
			$db->sql_return_on_error(false);					

			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=7").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['KINGDOM_CONFIG_UPDATE'].$return_link);	
		}
		
		$bdata = fetch_building_data($building_id);
								
		$acp_control_data = '
		<input type="hidden" name="building_id" value="'.$building_id.'">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_7'].'</b></span></td>
			</tr>
			<tr>';
			
		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" width="80%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['NAME'].'</b></span></td>
				<td class="game_row3" align="center" width="20%"  style="border-bottom:solid thin #000000;"><input type="text" name="building_name" class="game_post" maxlength="32" value="'.$bdata['building_name'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left"  style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['NETWORTH'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="building_net" class="game_post" maxlength="32" value="'.$bdata['building_net'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BUILDING_DEFENSE'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="building_def" class="game_post" maxlength="32" value="'.$bdata['building_def'].'" ></td>
			</tr>';

		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BUILDING_GOLD'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="building_gold" class="game_post" maxlength="32" value="'.$bdata['building_gold'].'" ></td>
			</tr>';


		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BUILDING_WOOD'].'</b></span></td>
				<td class="game_row3" align="center"  style="border-bottom:solid thin #000000;"><input type="text" name="building_wood" class="game_post" maxlength="32" value="'.$bdata['building_wood'].'" ></td>
			</tr>';


		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left"  style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BUILDING_IRON'].'</b></span></td>
				<td class="game_row3" align="center"   style="border-bottom:solid thin #000000;"><input type="text" name="building_iron" class="game_post" maxlength="32" value="'.$bdata['building_iron'].'" style="width="98%"></td>
			</tr>';		

		$acp_control_data .= '
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['UPDATE'].'"></td>
			</tr>				
		</table>';	
	}
	break;
		
	case 6:
		if($cmd == $user->lang['UPDATE'])
		{

			$quest_name = request_var('quest_name', '');
			$quest_stamina_req = request_var('quest_stamina_req', 1);

			// Lets make sure each quest has a name
			if(empty($quest_name))
			{
				$error = TRUE;
				$error_msgs .= $user->lang['QUEST_NAME_REQ'];				
			}
			
			// Lets make sure the each quest is using at least 1 stamina point
			if($quest_stamina_req < 1)
			{
				$error = TRUE;
				$error_msgs .= $user->lang['QUEST_STAMINA_REQUIRED'];
			}

			if(!$error)			
			{
				$sql_quest_ary = array(
					'quest_name' 						=> request_var('quest_name', ''),
					'quest_descript' 					=> request_var('quest_descript', ''),
					'quest_img_path' 					=> request_var('quest_img_path', ''),
					'quest_level_req' 					=> request_var('quest_level_req', 0),
					'quest_net_req' 					=> request_var('quest_net_req', 0),
					'quest_villagers_req' 				=> request_var('quest_villagers_req', 0),
					'quest_spies_req' 					=> request_var('quest_spies_req', 0),
					'quest_soldiers_req' 				=> request_var('quest_soldiers_req', 0),
					'quest_macemen_req' 				=> request_var('quest_macemen_req', 0),
					'quest_axemen_req' 					=> request_var('quest_axemen_req', 0),
					'quest_spearmen_req' 				=> request_var('quest_spearmen_req', 0),
					'quest_swordsmen_req' 				=> request_var('quest_swordsmen_req', 0),
					'quest_legionnaires_req' 			=> request_var('quest_legionnaires_req', 0),
					'quest_knights_req' 				=> request_var('quest_knights_req', 0),
					'quest_slingers_req' 				=> request_var('quest_slingers_req', 0),
					'quest_bowmen_req' 					=> request_var('quest_bowmen_req', 0),
					'quest_long_bowmen_req' 			=> request_var('quest_long_bowmen_req', 0),
					'quest_crossbowmen_req' 			=> request_var('quest_crossbowmen_req', 0),
					'quest_light_sword_cavalry_req' 	=> request_var('quest_light_sword_cavalry_req', 0),
					'quest_heavy_sword_cavalry_req' 	=> request_var('quest_heavy_sword_cavalry_req', 0),
					'quest_light_archer_cavalry_req' 	=> request_var('quest_light_archer_cavalry_req', 0),
					'quest_heavy_archer_cavalry_req' 	=> request_var('quest_heavy_archer_cavalry_req', 0),
					'quest_paladin_req' 				=> request_var('quest_paladin_req', 0),
					'quest_dragon_knights_req' 			=> request_var('quest_dragon_knights_req', 0),
					'quest_rams_req' 					=> request_var('quest_rams_req', 0),
					'quest_catapults_req' 				=> request_var('quest_catapults_req', 0),
					'quest_heavy_catapults_req' 		=> request_var('quest_heavy_catapults_req', 0),
					'quest_ballistas_req' 				=> request_var('quest_ballistas_req', 0),
					'quest_trebuchets_req' 				=> request_var('quest_trebuchets_req', 0),
					'quest_chimeras_req' 				=> request_var('quest_chimeras_req', 0),
					'quest_hydras_req' 					=> request_var('quest_hydras_req', 0),
					'quest_basilisks_req' 				=> request_var('quest_basilisks_req', 0),
					'quest_wyverns_req' 				=> request_var('quest_wyverns_req', 0),
					'quest_leviathans_req' 				=> request_var('quest_leviathans_req', 0),
					'quest_dragons_req' 				=> request_var('quest_dragons_req', 0),
					'quest_farms_req' 					=> request_var('quest_farms_req', 0),
					'quest_timber_mills_req' 			=> request_var('quest_timber_mills_req', 0),
					'quest_iron_mines_req' 				=> request_var('quest_iron_mines_req', 0),
					'quest_gold_mines_req' 				=> request_var('quest_gold_mines_req', 0),
					'quest_towers_req' 					=> request_var('quest_towers_req', 0),
					'quest_granaries_req' 				=> request_var('quest_granaries_req', 0),
					'quest_woodsheds_req' 				=> request_var('quest_woodsheds_req', 0),
					'quest_ironpits_req' 				=> request_var('quest_ironpits_req', 0),
					'quest_vaults_req' 					=> request_var('quest_vaults_req', 0),				
					'quest_land_req' 					=> request_var('quest_land_req', 0),
					'quest_stamina_req' 				=> request_var('quest_stamina_req', 1),				
					'quest_min_villagers' 				=> request_var('quest_min_villagers', 0),
					'quest_max_villagers' 				=> request_var('quest_max_villagers', 0),
					'quest_min_gold' 					=> request_var('quest_min_gold', 0),
					'quest_max_gold' 					=> request_var('quest_max_gold', 0),
					'quest_min_food' 					=> request_var('quest_min_food', 0),
					'quest_max_food' 					=> request_var('quest_max_food', 0),
					'quest_min_wood' 					=> request_var('quest_min_wood', 0),
					'quest_max_wood' 					=> request_var('quest_max_wood', 0),
					'quest_min_iron' 					=> request_var('quest_min_iron', 0),
					'quest_max_iron' 					=> request_var('quest_max_iron', 0),
					'quest_min_dragoncoins' 			=> request_var('quest_min_dragoncoins', 0),
					'quest_max_dragoncoins' 			=> request_var('quest_max_dragoncoins', 0),
					'quest_min_exp' 					=> request_var('quest_min_exp', 0),
					'quest_max_exp' 					=> request_var('quest_max_exp', 0),
					'quest_min_soldiers' 				=> request_var('quest_min_soldiers', 0),
					'quest_max_soldiers' 				=> request_var('quest_max_soldiers', 0),
					'quest_min_spies' 					=> request_var('quest_min_spies', 0),
					'quest_max_spies' 					=> request_var('quest_max_spies', 0),
					'quest_min_macemen' 				=> request_var('quest_min_macemen', 0),
					'quest_max_macemen' 				=> request_var('quest_max_macemen', 0),
					'quest_min_axemen' 					=> request_var('quest_min_axemen', 0),
					'quest_max_axemen' 					=> request_var('quest_max_axemen', 0),
					'quest_min_spearmen' 				=> request_var('quest_min_spearmen', 0),
					'quest_max_spearmen' 				=> request_var('quest_max_spearmen', 0),
					'quest_min_swordsmen' 				=> request_var('quest_min_swordsmen', 0),
					'quest_max_swordsmen' 				=> request_var('quest_max_swordsmen', 0),
					'quest_min_legionnaires' 			=> request_var('quest_min_legionnaires', 0),
					'quest_max_legionnaires' 			=> request_var('quest_max_legionnaires', 0),
					'quest_min_knights' 				=> request_var('quest_min_knights', 0),
					'quest_max_knights' 				=> request_var('quest_max_knights', 0),
					'quest_min_slingers' 				=> request_var('quest_min_slingers', 0),
					'quest_max_slingers' 				=> request_var('quest_max_slingers', 0),
					'quest_min_bowmen' 					=> request_var('quest_min_bowmen', 0),
					'quest_max_bowmen' 					=> request_var('quest_max_bowmen', 0),
					'quest_min_long_bowmen' 			=> request_var('quest_min_long_bowmen', 0),
					'quest_max_long_bowmen' 			=> request_var('quest_max_long_bowmen', 0),
					'quest_min_crossbowmen' 			=> request_var('quest_min_crossbowmen', 0),
					'quest_max_crossbowmen' 			=> request_var('quest_max_crossbowmen', 0),
					'quest_min_light_sword_cavalry' 	=> request_var('quest_min_light_sword_cavalry', 0),
					'quest_max_light_sword_cavalry' 	=> request_var('quest_max_light_sword_cavalry', 0),
					'quest_min_heavy_sword_cavalry' 	=> request_var('quest_min_heavy_sword_cavalry', 0),
					'quest_max_heavy_sword_cavalry' 	=> request_var('quest_max_heavy_sword_cavalry', 0),
					'quest_min_light_archer_cavalry' 	=> request_var('quest_min_light_archer_cavalry', 0),
					'quest_max_light_archer_cavalry' 	=> request_var('quest_max_light_archer_cavalry', 0),
					'quest_min_heavy_archer_cavalry' 	=> request_var('quest_min_heavy_archer_cavalry', 0),
					'quest_max_heavy_archer_cavalry' 	=> request_var('quest_max_heavy_archer_cavalry', 0),
					'quest_min_paladin' 				=> request_var('quest_min_paladin', 0),
					'quest_max_paladin' 				=> request_var('quest_max_paladin', 0),
					'quest_min_dragon_knights' 			=> request_var('quest_min_dragon_knights', 0),
					'quest_max_dragon_knights' 			=> request_var('quest_max_dragon_knights', 0),
					'quest_min_rams' 					=> request_var('quest_min_rams', 0),
					'quest_max_rams' 					=> request_var('quest_max_rams', 0),
					'quest_min_catapults' 				=> request_var('quest_min_catapults', 0),
					'quest_max_catapults' 				=> request_var('quest_max_catapults', 0),
					'quest_min_heavy_catapults' 		=> request_var('quest_min_heavy_catapults', 0),
					'quest_max_heavy_catapults' 		=> request_var('quest_max_heavy_catapults', 0),
					'quest_min_ballistas' 				=> request_var('quest_min_ballistas', 0),
					'quest_max_ballistas' 				=> request_var('quest_max_ballistas', 0),
					'quest_min_trebuchets' 				=> request_var('quest_min_trebuchets', 0),
					'quest_max_trebuchets' 				=> request_var('quest_max_trebuchets', 0),
					'quest_min_chimeras' 				=> request_var('quest_min_chimeras', 0),
					'quest_max_chimeras' 				=> request_var('quest_max_chimeras', 0),
					'quest_min_hydras' 					=> request_var('quest_min_hydras', 0),
					'quest_max_hydras' 					=> request_var('quest_max_hydras', 0),
					'quest_min_basilisks' 				=> request_var('quest_min_basilisks', 0),
					'quest_max_basilisks' 				=> request_var('quest_max_basilisks', 0),
					'quest_min_wyverns' 				=> request_var('quest_min_wyverns', 0),
					'quest_max_wyverns' 				=> request_var('quest_max_wyverns', 0),
					'quest_min_leviathans' 				=> request_var('quest_min_leviathans', 0),
					'quest_max_leviathans' 				=> request_var('quest_max_leviathans', 0),
					'quest_min_dragons' 				=> request_var('quest_min_dragons', 0),
					'quest_max_dragons' 				=> request_var('quest_max_dragons', 0),
					'quest_min_land' 					=> request_var('quest_min_land', 0),
					'quest_max_land' 					=> request_var('quest_max_land', 0),
					'quest_min_farms' 					=> request_var('quest_min_farms', 0),
					'quest_max_farms' 					=> request_var('quest_max_farms', 0),
					'quest_min_timber_mills' 			=> request_var('quest_min_timber_mills', 0),
					'quest_max_timber_mills' 			=> request_var('quest_max_timber_mills', 0),
					'quest_min_iron_mines' 				=> request_var('quest_min_iron_mines', 0),
					'quest_max_iron_mines' 				=> request_var('quest_max_iron_mines', 0),
					'quest_min_gold_mines' 				=> request_var('quest_min_gold_mines', 0),
					'quest_max_gold_mines' 				=> request_var('quest_max_gold_mines', 0),
					'quest_min_towers' 					=> request_var('quest_min_towers', 0),
					'quest_max_towers' 					=> request_var('quest_max_towers', 0),
					'quest_min_granaries' 				=> request_var('quest_min_granaries', 0),
					'quest_max_granaries' 				=> request_var('quest_max_granaries', 0),
					'quest_min_woodsheds' 				=> request_var('quest_min_woodsheds', 0),
					'quest_max_woodsheds' 				=> request_var('quest_max_woodsheds', 0),
					'quest_min_ironpits' 				=> request_var('quest_min_ironpits', 0),  
					'quest_max_ironpits' 				=> request_var('quest_max_ironpits', 0),
					'quest_min_vaults' 					=> request_var('quest_min_vaults', 0),
					'quest_max_vaults' 					=> request_var('quest_max_vaults', 0), 					
					'quest_chance' 						=> request_var('quest_chance', 0),
					'quest_approved' 					=> 1,
				);
				
				$sql = "UPDATE " . AOD_QUESTS_TABLE . ' SET ' . $db->sql_build_array('UPDATE' , $sql_quest_ary)." WHERE id = $qid"; 	  
				$db->sql_query($sql);
							
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=6").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['QUEST_UPDATED'].$return_link);
			}
		}
		
		if($cmd == 'approve')
		{
			if($qid)
			{
				approve_quest($qid);
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=6").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['QUEST_APPROVED_SUCCESSFULLY'].$return_link);					
			}
		}
		
		if($cmd == 'disapprove')
		{
			if($qid)
			{
				disapprove_quest($qid);
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=6").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['QUEST_DISAPPROVED_SUCCESSFULLY'].$return_link);					
			}
		}
		
		if($cmd == 'delete'){
			if($qid)
			{
				$s_hidden_fields = build_hidden_fields(array(
					'cmd' => 'delete_confirmed',
					'qid' => $qid,
					)
				);
		
				//Display confirm box
				confirm_box(false, $user->lang['CONFIRM_QUEST_DELETE'], $s_hidden_fields);	
			}			
		}
		
		if($cmd == 'delete_confirmed'){
			if (confirm_box(true))				
			{		
				// Remove the selected quest
				delete_quest($qid);

				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=6").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['QUEST_DELETED_SUCCESSFULLY'].$return_link);	
			}else{
				redirect(append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=6"));
			}		
		}
				
		if(!$qid){
			$sql = "SELECT * 
			FROM " . AOD_QUESTS_TABLE;
			$result = $db->sql_query($sql);
	
			while ($row = $db->sql_fetchrow($result))
			{
				if($row[quest_approved] == 1)
				{
					$quest_status = $user->lang['APPROVED'];					
					$status_cmd = '[ <a href="admincp.php?menu=6&cmd=disapprove&qid='.$row['id'].'"><span class="stext"><b>D</b></span></a> ]';
				}else{
					$quest_status = $user->lang['WAITING_APPROVAL'];
					$status_cmd = '[ <a href="admincp.php?menu=6&cmd=approve&qid='.$row['id'].'"><span class="stext"><b>A</b></span></a> ]';
				}
				
				$cur_quest_list .= '
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$row['quest_name'].'</b></span></td>
					<td class="game_row2" align="center" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$quest_status.'</b></span></td>
					<td class="game_row2" align="center" style="border-bottom:solid thin #000000;">
					<span class="stext"><b>
					[ <a href="admincp.php?menu=6&cmd=delete&qid='.$row['id'].'"><span class="stext"><b>X</b></span></a> ]
					[ <a href="admincp.php?menu=6&cmd=update&qid='.$row['id'].'"><span class="stext"><b>U</b></span></a> ]
					'.$status_cmd.'
					
					</b></span></td>
				</tr>';
			}	
			$db->sql_freeresult($result);	
					
			$acp_control_data = '
			<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
				<tr>
					<td colspan="3" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_6'].'</b></span></td>
				</tr>
				<tr>
					<td colspan="3" class="game_row1" align="center" style="border-bottom:solid thin #000000;"><span class="ntext"><b>'.$user->lang['QUEST_CONFIG_INFO'].'</b></span></td>
				</tr>				
				<tr>
					<td class="game_row3" align="center" width="50%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_NAME'].'</b></span></td>
					<td class="game_row3" align="center" width="25%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_STATUS'].'</b></span></td>
					<td class="game_row3" align="center" width="25%" style="border-bottom:solid thin #000000; "><span class="stext"><b>'.$user->lang['ACTION'].'</b></span></td>
				</tr>
				'.$cur_quest_list.'		
				<tr>
					<td colspan="3" class="game_header" align="center"><span class="stext"><b>&nbsp;</b></span></td>
				</tr>
			</table><br />';
		}else{

			$qdata = fetch_quest_data($qid);
			
			
			for ( $i=0; $i <= 99; ++$i )
			{ 
				if($i == $qdata['quest_chance']){
					

					if($qdata['quest_chance'] == 0){
						$chance_caption  = ' - '.$user->lang['EASIEST'];
					}elseif($qdata['quest_chance'] == 25){
						$chance_caption = ' - '.$user->lang['EASY'];
					}elseif($qdata['quest_chance'] == 50){
						$chance_caption = ' - '.$user->lang['50_50'];
					}elseif($qdata['quest_chance'] == 75){
						$chance_caption = ' - '.$user->lang['HARD'];
					}elseif($qdata['quest_chance'] == 99){
						$chance_caption = '- '.$user->lang['HARDEST'];
					}else{
						$chance_caption = NULL;
					}
					
					
					$chance_options .= '<option value="'.$qdata['quest_chance'].'" SELECTED>'.$qdata['quest_chance'].$chance_caption.'</option>';
			
				}elseif($i == 0){
					$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['EASIEST'].'</option>';
				}elseif($i == 25){
					$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['EASY'].'</option>';
				}elseif($i == 50){
					$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['50_50'].'</option>';
				}elseif($i == 75){
					$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['HARD'].'</option>';
				}elseif($i == 99){
					$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['HARDEST'].'</option>';
				}else{
					$chance_options .= '<option value="'.$i.'">'.$i.'</option>';
				}
			}
			
			
			$acp_control_data = '
			<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
				<tr>
					<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_5'].'</b></span></td>
				</tr>
				<tr>
					<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_NAME'].'</b></span></td>
					<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_name" class="game_post" maxlength="50" value="'.$qdata['quest_name'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_DESCRIPTION'].'</b></span></td>
					<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_descript" class="game_post" maxlength="255" value="'.$qdata['quest_descript'].'" style="width:97%;"></td>
				</tr>	
				<tr>
					<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_IMG'].'</b></span></td>
				</tr>			
				<tr>
					<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_IMG_PATH'].'</b></span></td>
					<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_img_path" class="game_post" maxlength="255" value="'.$qdata['quest_img_path'].'" style="width:97%;"></td>
				</tr>							
				<tr>
					<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_REQUIREMENTS'].'</b></span></td>
				</tr>							
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEVEL'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_level_req" class="game_post" maxlength="3" value="'.$qdata['quest_level_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_NET'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_net_req" class="game_post" maxlength="20" value="'.$qdata['quest_net_req'].'" style="width:97%;"></td>
				</tr>			
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_VILLAGERS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_villagers_req" class="game_post" maxlength="20" value="'.$qdata['quest_villagers_req'].'" style="width:97%;"></td>
				</tr>	
				
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SPIES'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_spies_req" class="game_post" maxlength="20" value="'.$qdata['quest_spies_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SOLDIERS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_soldiers_req" class="game_post" maxlength="20" value="'.$qdata['quest_soldiers_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_MACEMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_macemen_req" class="game_post" maxlength="20" value="'.$qdata['quest_macemen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_AXEMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_axemen_req" class="game_post" maxlength="20" value="'.$qdata['quest_axemen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SPEARMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_spearmen_req" class="game_post" maxlength="20" value="'.$qdata['quest_spearmen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SWORDSMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_swordsmen_req" class="game_post" maxlength="20" value="'.$qdata['quest_swordsmen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEGIONNAIRES'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_legionnaires_req" class="game_post" maxlength="20" value="'.$qdata['quest_legionnaires_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_KNIGHTS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_knights_req" class="game_post" maxlength="20" value="'.$qdata['quest_knights_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SLINGERS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_slingers_req" class="game_post" maxlength="20" value="'.$qdata['quest_slingers_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BOWMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_bowmen_req" class="game_post" maxlength="20" value="'.$qdata['quest_bowmen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LONG_BOWMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_long_bowmen_req" class="game_post" maxlength="20" value="'.$qdata['quest_long_bowmen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CROSS_BOWMEN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_crossbowmen_req" class="game_post" maxlength="20" value="'.$qdata['quest_crossbowmen_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LIGHT_SWORD_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_light_sword_cavalry_req" class="game_post" maxlength="20" value="'.$qdata['quest_light_sword_cavalry_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_SWORD_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_sword_cavalry_req" class="game_post" maxlength="20" value="'.$qdata['quest_heavy_sword_cavalry_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LIGHT_ARCHER_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_light_archer_cavalry_req" class="game_post" maxlength="20" value="'.$qdata['quest_light_archer_cavalry_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_ARCHER_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_archer_cavalry_req" class="game_post" maxlength="20" value="'.$qdata['quest_heavy_archer_cavalry_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_PALADIN'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_paladin_req" class="game_post" maxlength="20" value="'.$qdata['quest_paladin_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_DRAGON_KNIGHT'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_dragon_knights_req" class="game_post" maxlength="20" value="'.$qdata['quest_dragon_knights_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_RAMS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_rams_req" class="game_post" maxlength="20" value="'.$qdata['quest_rams_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CATAPULTS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_catapults_req" class="game_post" maxlength="20" value="'.$qdata['quest_catapults_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_CATAPULTS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_catapults_req" class="game_post" maxlength="20" value="'.$qdata['quest_heavy_catapults_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BALLISTAS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_ballistas_req" class="game_post" maxlength="20" value="'.$qdata['quest_ballistas_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TREBUCHETS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_trebuchets_req" class="game_post" maxlength="20" value="'.$qdata['quest_trebuchets_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CHIMERAS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_chimeras_req" class="game_post" maxlength="20" value="'.$qdata['quest_chimeras_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HYDRAS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_hydras_req" class="game_post" maxlength="20" value="'.$qdata['quest_hydras_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BASILISKS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_basilisks_req" class="game_post" maxlength="20" value="'.$qdata['quest_basilisks_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_WYVERNS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_wyverns_req" class="game_post" maxlength="20" value="'.$qdata['quest_wyverns_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEVIATHANS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_leviathans_req" class="game_post" maxlength="20" value="'.$qdata['quest_leviathans_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_DRAGONS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_dragons_req" class="game_post" maxlength="20" value="'.$qdata['quest_dragons_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_FARMS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_farms_req" class="game_post" maxlength="20" value="'.$qdata['quest_farms_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TIMBER_MILLS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_timber_mills_req" class="game_post" maxlength="20" value="'.$qdata['quest_timber_mills_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_IRON_MINES'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_iron_mines_req" class="game_post" maxlength="20" value="'.$qdata['quest_iron_mines_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_GOLD_MINES'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_gold_mines_req" class="game_post" maxlength="20" value="'.$qdata['quest_gold_mines_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TOWERS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_towers_req" class="game_post" maxlength="20" value="'.$qdata['quest_towers_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_GRANARIES'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_granaries_req" class="game_post" maxlength="20" value="'.$qdata['quest_granaries_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_WOOD_SHEDS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_woodsheds_req" class="game_post" maxlength="20" value="'.$qdata['quest_woodsheds_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_IRON_PITS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_ironpits_req" class="game_post" maxlength="20" value="'.$qdata['quest_ironpits_req'].'" style="width:97%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_VAULTS'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_vaults_req" class="game_post" maxlength="20" value="'.$qdata['quest_vaults_req'].'" style="width:97%;"></td>
				</tr>
												
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LAND'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_land_req" class="game_post" maxlength="20" value="'.$qdata['quest_land_req'].'" style="width:97%;"></td>
				</tr>			
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_STAMINA'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_stamina_req" class="game_post" maxlength="20" value="'.$qdata['quest_stamina_req'].'" style="width:97%;"></td>
				</tr>			
				<tr>
					<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_REWARDS'].'</b></span></td>
				</tr>				
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['VILLAGERS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_villagers" class="game_post" maxlength="20" value="'.$qdata['quest_min_villagers'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_villagers" class="game_post" maxlength="20" value="'.$qdata['quest_max_villagers'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GOLD'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_gold" class="game_post" maxlength="20" value="'.$qdata['quest_min_gold'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_gold" class="game_post" maxlength="20" value="'.$qdata['quest_max_gold'].'" style="width:85%;"></td>
				</tr>	
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['FOOD'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_food" class="game_post" maxlength="20" value="'.$qdata['quest_min_food'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_food" class="game_post" maxlength="20" value="'.$qdata['quest_max_food'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WOOD'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_wood" class="game_post" maxlength="20" value="'.$qdata['quest_min_wood'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_wood" class="game_post" maxlength="20" value="'.$qdata['quest_max_wood'].'" style="width:85%;"></td>
				</tr>			
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_iron" class="game_post" maxlength="20" value="'.$qdata['quest_min_iron'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_iron" class="game_post" maxlength="20" value="'.$qdata['quest_max_iron'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGON_COINS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragoncoins" class="game_post" maxlength="20" value="'.$qdata['quest_min_dragoncoins'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragoncoins" class="game_post" maxlength="20" value="'.$qdata['quest_max_dragoncoins'].'" style="width:85%;"></td>
				</tr>			
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['EXPS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_exp" class="game_post" maxlength="4" value="'.$qdata['quest_min_exp'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_exp" class="game_post" maxlength="4" value="'.$qdata['quest_max_exp'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SOLDIERS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_soldiers" class="game_post" maxlength="20" value="'.$qdata['quest_min_soldiers'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_soldiers" class="game_post" maxlength="20" value="'.$qdata['quest_max_soldiers'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SPIES'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_spies" class="game_post" maxlength="20" value="'.$qdata['quest_min_spies'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_spies" class="game_post" maxlength="20" value="'.$qdata['quest_max_spies'].'" style="width:85%;"></td>
				</tr>							
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MACEMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_macemen" class="game_post" maxlength="20" value="'.$qdata['quest_min_macemen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_macemen" class="game_post" maxlength="20" value="'.$qdata['quest_max_macemen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['AXEMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_axemen" class="game_post" maxlength="20" value="'.$qdata['quest_min_axemen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_axemen" class="game_post" maxlength="20" value="'.$qdata['quest_max_axemen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SPEARMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_spearmen" class="game_post" maxlength="20" value="'.$qdata['quest_min_spearmen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_spearmen" class="game_post" maxlength="20" value="'.$qdata['quest_max_spearmen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SWORDSMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_swordsmen" class="game_post" maxlength="20" value="'.$qdata['quest_min_swordsmen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_swordsmen" class="game_post" maxlength="20" value="'.$qdata['quest_max_swordsmen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEGIONNAIRES'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_legionnaires" class="game_post" maxlength="20" value="'.$qdata['quest_min_legionnaires'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_legionnaires" class="game_post" maxlength="20" value="'.$qdata['quest_max_legionnaires'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KNIGHTS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_knights" class="game_post" maxlength="20" value="'.$qdata['quest_min_knights'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_knights" class="game_post" maxlength="20" value="'.$qdata['quest_max_knights'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SLINGERS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_slingers" class="game_post" maxlength="20" value="'.$qdata['quest_min_slingers'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_slingers" class="game_post" maxlength="20" value="'.$qdata['quest_max_slingers'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BOWMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_bowmen" class="game_post" maxlength="20" value="'.$qdata['quest_min_bowmen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_bowmen" class="game_post" maxlength="20" value="'.$qdata['quest_max_bowmen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LONG_BOWMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_long_bowmen" class="game_post" maxlength="20" value="'.$qdata['quest_min_long_bowmen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_long_bowmen" class="game_post" maxlength="20" value="'.$qdata['quest_max_long_bowmen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CROSS_BOWMEN'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_crossbowmen" class="game_post" maxlength="20" value="'.$qdata['quest_min_crossbowmen'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_crossbowmen" class="game_post" maxlength="20" value="'.$qdata['quest_max_crossbowmen'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LIGHT_SWORD_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_light_sword_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_min_light_sword_cavalry'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_light_sword_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_max_light_sword_cavalry'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_SWORD_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_sword_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_min_heavy_sword_cavalry'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_sword_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_max_heavy_sword_cavalry'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LIGHT_ARCHER_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_light_archer_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_min_light_archer_cavalry'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_light_archer_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_max_light_archer_cavalry'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_ARCHER_CAVALRY'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_archer_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_min_heavy_archer_cavalry'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_archer_cavalry" class="game_post" maxlength="20" value="'.$qdata['quest_max_heavy_archer_cavalry'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['PALADINS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_paladin" class="game_post" maxlength="20" value="'.$qdata['quest_min_paladin'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_paladin" class="game_post" maxlength="20" value="'.$qdata['quest_max_paladin'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGON_KNIGHTS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragon_knights" class="game_post" maxlength="20" value="'.$qdata['quest_min_dragon_knights'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragon_knights" class="game_post" maxlength="20" value="'.$qdata['quest_max_dragon_knights'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['RAMS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_rams" class="game_post" maxlength="20" value="'.$qdata['quest_min_rams'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_rams" class="game_post" maxlength="20" value="'.$qdata['quest_max_rams'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CATAPULTS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_catapults" class="game_post" maxlength="20" value="'.$qdata['quest_min_catapults'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_catapults" class="game_post" maxlength="20" value="'.$qdata['quest_max_catapults'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_CATAPULTS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_catapults" class="game_post" maxlength="20" value="'.$qdata['quest_min_heavy_catapults'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_catapults" class="game_post" maxlength="20" value="'.$qdata['quest_max_heavy_catapults'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BALLISTAS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_ballistas" class="game_post" maxlength="20" value="'.$qdata['quest_min_ballistas'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_ballistas" class="game_post" maxlength="20" value="'.$qdata['quest_max_ballistas'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TREBUCHETS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_trebuchets" class="game_post" maxlength="20" value="'.$qdata['quest_min_trebuchets'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_trebuchets" class="game_post" maxlength="20" value="'.$qdata['quest_max_trebuchets'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CHIMERAS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_chimeras" class="game_post" maxlength="20" value="'.$qdata['quest_min_chimeras'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_chimeras" class="game_post" maxlength="20" value="'.$qdata['quest_max_chimeras'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HYDRAS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_hydras" class="game_post" maxlength="20" value="'.$qdata['quest_min_hydras'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_hydras" class="game_post" maxlength="20" value="'.$qdata['quest_max_hydras'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BASILISKS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_basilisks" class="game_post" maxlength="20" value="'.$qdata['quest_min_basilisks'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_basilisks" class="game_post" maxlength="20" value="'.$qdata['quest_max_basilisks'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WYVERNS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_wyverns" class="game_post" maxlength="20" value="'.$qdata['quest_min_wyverns'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_wyverns" class="game_post" maxlength="20" value="'.$qdata['quest_max_wyverns'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVIATHANS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_leviathans" class="game_post" maxlength="20" value="'.$qdata['quest_min_leviathans'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_leviathans" class="game_post" maxlength="20" value="'.$qdata['quest_max_leviathans'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGONS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragons" class="game_post" maxlength="20" value="'.$qdata['quest_min_dragons'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragons" class="game_post" maxlength="20" value="'.$qdata['quest_max_dragons'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LAND'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_land" class="game_post" maxlength="20" value="'.$qdata['quest_min_land'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_land" class="game_post" maxlength="20" value="'.$qdata['quest_max_land'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['FARMS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_farms" class="game_post" maxlength="20" value="'.$qdata['quest_min_farms'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_farms" class="game_post" maxlength="20" value="'.$qdata['quest_max_farms'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TIMBER_MILLS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_timber_mills" class="game_post" maxlength="20" value="'.$qdata['quest_min_timber_mills'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_timber_mills" class="game_post" maxlength="20" value="'.$qdata['quest_max_timber_mills'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON_MINES'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_iron_mines" class="game_post" maxlength="20" value="'.$qdata['quest_min_iron_mines'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_iron_mines" class="game_post" maxlength="20" value="'.$qdata['quest_max_iron_mines'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GOLD_MINES'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_gold_mines" class="game_post" maxlength="20" value="'.$qdata['quest_min_gold_mines'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_gold_mines" class="game_post" maxlength="20" value="'.$qdata['quest_max_gold_mines'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TOWERS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_towers" class="game_post" maxlength="20" value="'.$qdata['quest_min_towers'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_towers" class="game_post" maxlength="20" value="'.$qdata['quest_max_towers'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GRANARIES'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_granaries" class="game_post" maxlength="20" value="'.$qdata['quest_min_granaries'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_granaries" class="game_post" maxlength="20" value="'.$qdata['quest_max_granaries'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WOOD_SHEDS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_woodsheds" class="game_post" maxlength="20" value="'.$qdata['quest_min_woodsheds'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_woodsheds" class="game_post" maxlength="20" value="'.$qdata['quest_max_woodsheds'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON_PITS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_ironpits" class="game_post" maxlength="20" value="'.$qdata['quest_min_ironpits'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_ironpits" class="game_post" maxlength="20" value="'.$qdata['quest_max_ironpits'].'" style="width:85%;"></td>
				</tr>
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['VAULTS'].'</b></span></td>
					<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
					'.$user->lang['MIN'].' :<input type="text" name="quest_min_vaults" class="game_post" maxlength="20" value="'.$qdata['quest_min_vaults'].'" style="width:85%;"><br />
					'.$user->lang['MAX'].' :<input type="text" name="quest_max_vaults" class="game_post" maxlength="20" value="'.$qdata['quest_max_vaults'].'" style="width:85%;"></td>
				</tr>						
				<tr>
					<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['DIFFICULTY_SETTINGS'].'</b></span></td>
				</tr>			
				<tr>
					<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SUCCESS_CHANCE'].'</b></span></td>
					<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><select name="quest_chance" class="game_post" style="width:97%;">'.$chance_options.'</select></td>
				</tr>			
															
				<tr>
					<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['UPDATE'].'"></td>
				</tr>
			</table><br />';			
			
		}
	break;
		
	case 5:

		// Post new quests
		if($cmd == $user->lang['SUBMIT'])
		{
			$quest_name = request_var('quest_name', '');
			$quest_stamina_req = request_var('quest_stamina_req', 1);

			// Lets make sure each quest has a name
			if(empty($quest_name))
			{
				$error = TRUE;
				$error_msgs .= $user->lang['QUEST_NAME_REQ'];				
			}
			
			// Lets make sure the each quest is using at least 1 stamina point
			if($quest_stamina_req < 1)
			{
				$error = TRUE;
				$error_msgs .= $user->lang['QUEST_STAMINA_REQUIRED'];
			}
						
			if(!$error)
			{
				$sql_quest_ary = array(
					'quest_name' 						=> request_var('quest_name', ''),
					'quest_descript' 					=> request_var('quest_descript', ''),
					'quest_img_path' 					=> request_var('quest_img_path', ''),					
					'quest_level_req' 					=> request_var('quest_level_req', 0),
					'quest_net_req' 					=> request_var('quest_net_req', 0),
					'quest_villagers_req' 				=> request_var('quest_villagers_req', 0),
					'quest_spies_req' 					=> request_var('quest_spies_req', 0),
					'quest_soldiers_req' 				=> request_var('quest_soldiers_req', 0),
					'quest_macemen_req' 				=> request_var('quest_macemen_req', 0),
					'quest_axemen_req' 					=> request_var('quest_axemen_req', 0),
					'quest_spearmen_req' 				=> request_var('quest_spearmen_req', 0),
					'quest_swordsmen_req' 				=> request_var('quest_swordsmen_req', 0),
					'quest_legionnaires_req' 			=> request_var('quest_legionnaires_req', 0),
					'quest_knights_req' 				=> request_var('quest_knights_req', 0),
					'quest_slingers_req' 				=> request_var('quest_slingers_req', 0),
					'quest_bowmen_req' 					=> request_var('quest_bowmen_req', 0),
					'quest_long_bowmen_req' 			=> request_var('quest_long_bowmen_req', 0),
					'quest_crossbowmen_req' 			=> request_var('quest_crossbowmen_req', 0),
					'quest_light_sword_cavalry_req' 	=> request_var('quest_light_sword_cavalry_req', 0),
					'quest_heavy_sword_cavalry_req' 	=> request_var('quest_heavy_sword_cavalry_req', 0),
					'quest_light_archer_cavalry_req' 	=> request_var('quest_light_archer_cavalry_req', 0),
					'quest_heavy_archer_cavalry_req' 	=> request_var('quest_heavy_archer_cavalry_req', 0),
					'quest_paladin_req' 				=> request_var('quest_paladin_req', 0),
					'quest_dragon_knights_req' 			=> request_var('quest_dragon_knights_req', 0),
					'quest_rams_req' 					=> request_var('quest_rams_req', 0),
					'quest_catapults_req' 				=> request_var('quest_catapults_req', 0),
					'quest_heavy_catapults_req' 		=> request_var('quest_heavy_catapults_req', 0),
					'quest_ballistas_req' 				=> request_var('quest_ballistas_req', 0),
					'quest_trebuchets_req' 				=> request_var('quest_trebuchets_req', 0),
					'quest_chimeras_req' 				=> request_var('quest_chimeras_req', 0),
					'quest_hydras_req' 					=> request_var('quest_hydras_req', 0),
					'quest_basilisks_req' 				=> request_var('quest_basilisks_req', 0),
					'quest_wyverns_req' 				=> request_var('quest_wyverns_req', 0),
					'quest_leviathans_req' 				=> request_var('quest_leviathans_req', 0),
					'quest_dragons_req' 				=> request_var('quest_dragons_req', 0),
					'quest_farms_req' 					=> request_var('quest_farms_req', 0),
					'quest_timber_mills_req' 			=> request_var('quest_timber_mills_req', 0),
					'quest_iron_mines_req' 				=> request_var('quest_iron_mines_req', 0),
					'quest_gold_mines_req' 				=> request_var('quest_gold_mines_req', 0),
					'quest_towers_req' 					=> request_var('quest_towers_req', 0),
					'quest_granaries_req' 				=> request_var('quest_granaries_req', 0),
					'quest_woodsheds_req' 				=> request_var('quest_woodsheds_req', 0),
					'quest_ironpits_req' 				=> request_var('quest_ironpits_req', 0),
					'quest_vaults_req' 					=> request_var('quest_vaults_req', 0),				
					'quest_land_req' 					=> request_var('quest_land_req', 0),
					'quest_stamina_req' 				=> request_var('quest_stamina_req', 1),
					'quest_min_villagers' 				=> request_var('quest_min_villagers', 0),
					'quest_max_villagers' 				=> request_var('quest_max_villagers', 0),
					'quest_min_gold' 					=> request_var('quest_min_gold', 0),
					'quest_max_gold' 					=> request_var('quest_max_gold', 0),
					'quest_min_food' 					=> request_var('quest_min_food', 0),
					'quest_max_food' 					=> request_var('quest_max_food', 0),
					'quest_min_wood' 					=> request_var('quest_min_wood', 0),
					'quest_max_wood' 					=> request_var('quest_max_wood', 0),
					'quest_min_iron' 					=> request_var('quest_min_iron', 0),
					'quest_max_iron' 					=> request_var('quest_max_iron', 0),
					'quest_min_dragoncoins' 			=> request_var('quest_min_dragoncoins', 0),
					'quest_max_dragoncoins' 			=> request_var('quest_max_dragoncoins', 0),
					'quest_min_exp' 					=> request_var('quest_min_exp', 0),
					'quest_max_exp' 					=> request_var('quest_max_exp', 0),	
					'quest_min_soldiers' 				=> request_var('quest_min_soldiers', 0),
					'quest_max_soldiers' 				=> request_var('quest_max_soldiers', 0),
					'quest_min_spies' 					=> request_var('quest_min_spies', 0),
					'quest_max_spies' 					=> request_var('quest_max_spies', 0),
					'quest_min_macemen' 				=> request_var('quest_min_macemen', 0),
					'quest_max_macemen' 				=> request_var('quest_max_macemen', 0),
					'quest_min_axemen' 					=> request_var('quest_min_axemen', 0),
					'quest_max_axemen' 					=> request_var('quest_max_axemen', 0),
					'quest_min_spearmen' 				=> request_var('quest_min_spearmen', 0),
					'quest_max_spearmen' 				=> request_var('quest_max_spearmen', 0),
					'quest_min_swordsmen' 				=> request_var('quest_min_swordsmen', 0),
					'quest_max_swordsmen' 				=> request_var('quest_max_swordsmen', 0),
					'quest_min_legionnaires' 			=> request_var('quest_min_legionnaires', 0),
					'quest_max_legionnaires' 			=> request_var('quest_max_legionnaires', 0),
					'quest_min_knights' 				=> request_var('quest_min_knights', 0),
					'quest_max_knights' 				=> request_var('quest_max_knights', 0),
					'quest_min_slingers' 				=> request_var('quest_min_slingers', 0),
					'quest_max_slingers' 				=> request_var('quest_max_slingers', 0),
					'quest_min_bowmen' 					=> request_var('quest_min_bowmen', 0),
					'quest_max_bowmen' 					=> request_var('quest_max_bowmen', 0),
					'quest_min_long_bowmen' 			=> request_var('quest_min_long_bowmen', 0),
					'quest_max_long_bowmen' 			=> request_var('quest_max_long_bowmen', 0),
					'quest_min_crossbowmen' 			=> request_var('quest_min_crossbowmen', 0),
					'quest_max_crossbowmen' 			=> request_var('quest_max_crossbowmen', 0),
					'quest_min_light_sword_cavalry' 	=> request_var('quest_min_light_sword_cavalry', 0),
					'quest_max_light_sword_cavalry' 	=> request_var('quest_max_light_sword_cavalry', 0),
					'quest_min_heavy_sword_cavalry' 	=> request_var('quest_min_heavy_sword_cavalry', 0),
					'quest_max_heavy_sword_cavalry' 	=> request_var('quest_max_heavy_sword_cavalry', 0),
					'quest_min_light_archer_cavalry' 	=> request_var('quest_min_light_archer_cavalry', 0),
					'quest_max_light_archer_cavalry' 	=> request_var('quest_max_light_archer_cavalry', 0),
					'quest_min_heavy_archer_cavalry' 	=> request_var('quest_min_heavy_archer_cavalry', 0),
					'quest_max_heavy_archer_cavalry' 	=> request_var('quest_max_heavy_archer_cavalry', 0),
					'quest_min_paladin' 				=> request_var('quest_min_paladin', 0),
					'quest_max_paladin' 				=> request_var('quest_max_paladin', 0),
					'quest_min_dragon_knights' 			=> request_var('quest_min_dragon_knights', 0),
					'quest_max_dragon_knights' 			=> request_var('quest_max_dragon_knights', 0),
					'quest_min_rams' 					=> request_var('quest_min_rams', 0),
					'quest_max_rams' 					=> request_var('quest_max_rams', 0),
					'quest_min_catapults' 				=> request_var('quest_min_catapults', 0),
					'quest_max_catapults' 				=> request_var('quest_max_catapults', 0),
					'quest_min_heavy_catapults' 		=> request_var('quest_min_heavy_catapults', 0),
					'quest_max_heavy_catapults' 		=> request_var('quest_max_heavy_catapults', 0),
					'quest_min_ballistas' 				=> request_var('quest_min_ballistas', 0),
					'quest_max_ballistas' 				=> request_var('quest_max_ballistas', 0),
					'quest_min_trebuchets' 				=> request_var('quest_min_trebuchets', 0),
					'quest_max_trebuchets' 				=> request_var('quest_max_trebuchets', 0),
					'quest_min_chimeras' 				=> request_var('quest_min_chimeras', 0),
					'quest_max_chimeras' 				=> request_var('quest_max_chimeras', 0),
					'quest_min_hydras' 					=> request_var('quest_min_hydras', 0),
					'quest_max_hydras' 					=> request_var('quest_max_hydras', 0),
					'quest_min_basilisks' 				=> request_var('quest_min_basilisks', 0),
					'quest_max_basilisks' 				=> request_var('quest_max_basilisks', 0),
					'quest_min_wyverns' 				=> request_var('quest_min_wyverns', 0),
					'quest_max_wyverns' 				=> request_var('quest_max_wyverns', 0),
					'quest_min_leviathans' 				=> request_var('quest_min_leviathans', 0),
					'quest_max_leviathans' 				=> request_var('quest_max_leviathans', 0),
					'quest_min_dragons' 				=> request_var('quest_min_dragons', 0),
					'quest_max_dragons' 				=> request_var('quest_max_dragons', 0),
					'quest_min_land' 					=> request_var('quest_min_land', 0),
					'quest_max_land' 					=> request_var('quest_max_land', 0),
					'quest_min_farms' 					=> request_var('quest_min_farms', 0),
					'quest_max_farms' 					=> request_var('quest_max_farms', 0),
					'quest_min_timber_mills' 			=> request_var('quest_min_timber_mills', 0),
					'quest_max_timber_mills' 			=> request_var('quest_max_timber_mills', 0),
					'quest_min_iron_mines' 				=> request_var('quest_min_iron_mines', 0),
					'quest_max_iron_mines' 				=> request_var('quest_max_iron_mines', 0),
					'quest_min_gold_mines' 				=> request_var('quest_min_gold_mines', 0),
					'quest_max_gold_mines' 				=> request_var('quest_max_gold_mines', 0),
					'quest_min_towers' 					=> request_var('quest_min_towers', 0),
					'quest_max_towers' 					=> request_var('quest_max_towers', 0),
					'quest_min_granaries' 				=> request_var('quest_min_granaries', 0),
					'quest_max_granaries' 				=> request_var('quest_max_granaries', 0),
					'quest_min_woodsheds' 				=> request_var('quest_min_woodsheds', 0),
					'quest_max_woodsheds' 				=> request_var('quest_max_woodsheds', 0),
					'quest_min_ironpits' 				=> request_var('quest_min_ironpits', 0),  
					'quest_max_ironpits' 				=> request_var('quest_max_ironpits', 0),
					'quest_min_vaults' 					=> request_var('quest_min_vaults', 0),
					'quest_max_vaults' 					=> request_var('quest_max_vaults', 0),  
					'quest_chance' 						=> request_var('quest_chance', 0),
					'quest_approved' 					=> 1,
				);
				
				
				add_quest($sql_quest_ary);					
	
				
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=5").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['NEW_QUEST_ADDED'].$return_link);
			}
		}
		
			
		for ( $i=0; $i <= 99; ++$i )
		{ 
			if($i == 0){
				$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['EASIEST'].'</option>';
			}elseif($i == 25){
				$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['EASY'].'</option>';
			}elseif($i == 50){
				$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['50_50'].'</option>';
			}elseif($i == 75){
				$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['HARD'].'</option>';
			}elseif($i == 99){
				$chance_options .= '<option value="'.$i.'">'.$i.' - '.$user->lang['HARDEST'].'</option>';
			}else{
				$chance_options .= '<option value="'.$i.'">'.$i.'</option>';
			}
		}
		
		
		$acp_control_data = '
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_5'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_NAME'].'</b></span></td>
				<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_name" class="game_post" maxlength="50" value="" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_DESCRIPTION'].'</b></span></td>
				<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_descript" class="game_post" maxlength="255" value="" style="width:97%;"></td>
			</tr>
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_IMG'].'</b></span></td>
			</tr>			
			<tr>
				<td class="game_row2" width="50%" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['QUEST_IMG_PATH'].'</b></span></td>
				<td class="game_row3" width="50%" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_img_path" class="game_post" maxlength="255" value="" style="width:97%;"></td>
			</tr>							
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_REQUIREMENTS'].'</b></span></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_level_req" class="game_post" maxlength="3" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_NET'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_net_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_VILLAGERS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_villagers_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SPIES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_spies_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SOLDIERS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_soldiers_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_MACEMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_macemen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_AXEMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_axemen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SPEARMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_spearmen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SWORDSMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_swordsmen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEGIONNAIRES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_legionnaires_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_KNIGHTS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_knights_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_SLINGERS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_slingers_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BOWMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_bowmen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LONG_BOWMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_long_bowmen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CROSS_BOWMEN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_crossbowmen_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LIGHT_SWORD_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_light_sword_cavalry_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_SWORD_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_sword_cavalry_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LIGHT_ARCHER_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_light_archer_cavalry_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_ARCHER_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_archer_cavalry_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_PALADIN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_paladin_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_DRAGON_KNIGHT'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_dragon_knights_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_RAMS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_rams_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CATAPULTS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_catapults_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HEAVY_CATAPULTS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_heavy_catapults_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BALLISTAS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_ballistas_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TREBUCHETS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_trebuchets_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_CHIMERAS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_chimeras_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_HYDRAS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_hydras_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_BASILISKS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_basilisks_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_WYVERNS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_wyverns_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LEVIATHANS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_leviathans_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_DRAGONS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_dragons_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_FARMS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_farms_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TIMBER_MILLS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_timber_mills_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_IRON_MINES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_iron_mines_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_GOLD_MINES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_gold_mines_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_TOWERS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_towers_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_GRANARIES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_granaries_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_WOOD_SHEDS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_woodsheds_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_IRON_PITS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_ironpits_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_VAULTS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_vaults_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>							
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_LAND'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_land_req" class="game_post" maxlength="20" value="0" style="width:97%;"></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MIN_REQ_STAMINA'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="quest_stamina_req" class="game_post" maxlength="20" value="1" style="width:97%;"></td>
			</tr>			
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['QUEST_REWARDS'].'</b></span></td>
			</tr>				
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['VILLAGERS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_villagers" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_villagers" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GOLD'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_gold" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_gold" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>	
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['FOOD'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_food" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_food" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WOOD'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_wood" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_wood" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_iron" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_iron" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGON_COINS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragoncoins" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragoncoins" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['EXPS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_exp" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_exp" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SOLDIERS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_soldiers" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_soldiers" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SPIES'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_spies" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_spies" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>							
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['MACEMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_macemen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_macemen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['AXEMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_axemen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_axemen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SPEARMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_spearmen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_spearmen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SWORDSMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_swordsmen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_swordsmen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEGIONNAIRES'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_legionnaires" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_legionnaires" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KNIGHTS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_knights" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_knights" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SLINGERS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_slingers" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_slingers" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BOWMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_bowmen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_bowmen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LONG_BOWMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_long_bowmen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_long_bowmen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CROSS_BOWMEN'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_crossbowmen" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_crossbowmen" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LIGHT_SWORD_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_light_sword_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_light_sword_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_SWORD_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_sword_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_sword_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LIGHT_ARCHER_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_light_archer_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_light_archer_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_ARCHER_CAVALRY'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_archer_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_archer_cavalry" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['PALADINS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_paladin" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_paladin" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGON_KNIGHTS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragon_knights" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragon_knights" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['RAMS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_rams" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_rams" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CATAPULTS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_catapults" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_catapults" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HEAVY_CATAPULTS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_heavy_catapults" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_heavy_catapults" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BALLISTAS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_ballistas" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_ballistas" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TREBUCHETS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_trebuchets" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_trebuchets" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['CHIMERAS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_chimeras" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_chimeras" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['HYDRAS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_hydras" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_hydras" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['BASILISKS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_basilisks" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_basilisks" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WYVERNS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_wyverns" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_wyverns" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVIATHANS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_leviathans" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_leviathans" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['DRAGONS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_dragons" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_dragons" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LAND'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_land" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_land" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['FARMS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_farms" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_farms" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TIMBER_MILLS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_timber_mills" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_timber_mills" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON_MINES'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_iron_mines" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_iron_mines" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GOLD_MINES'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_gold_mines" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_gold_mines" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['TOWERS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_towers" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_towers" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GRANARIES'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_granaries" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_granaries" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WOOD_SHEDS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_woodsheds" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_woodsheds" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON_PITS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_ironpits" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_ironpits" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['VAULTS'].'</b></span></td>
				<td class="game_row3" align="right" style="border-bottom:solid thin #000000;">
				'.$user->lang['MIN'].' :<input type="text" name="quest_min_vaults" class="game_post" maxlength="20" value="0" style="width:85%;"><br />
				'.$user->lang['MAX'].' :<input type="text" name="quest_max_vaults" class="game_post" maxlength="20" value="0" style="width:85%;"></td>
			</tr>				
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['DIFFICULTY_SETTINGS'].'</b></span></td>
			</tr>			
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['SUCCESS_CHANCE'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><select name="quest_chance" class="game_post" style="width:97%;">'.$chance_options.'</select></td>
			</tr>			
														
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['SUBMIT'].'"></td>
			</tr>
		</table><br />';			
	break;
		
	case 4:
				
	if(!$uid){
		
		$player_option_list = build_player_option_list(TRUE);
		
		// List all the players
		$acp_control_data = '
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_4'].' - '.$user->lang['USER_LIST'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="right" width="25%" ><span class="stext"><b>'.$user->lang['USERS'].' :</b></span></td>
				<td class="game_row3" align="center" width="75%" ><select name="uid" class="game_post">'.$player_option_list.'</select></td>
			</tr>		
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['SELECT'].'"></td>
			</tr>
		</table><br />';
		
	}else{

		// Update Game Config
		if($cmd == $user->lang['UPDATE'])
		{
			$sql_ary = array(
				'kingdom_status' 				=> request_var('kingdom_status', 0),
				'kingdom_name' 					=> request_var('kingdom_name', ''),
				'kingdom_ruler' 				=> request_var('kingdom_ruler', ''),
				'kingdom_level' 				=> request_var('kingdom_level', 1),
				'kingdom_exp' 					=> request_var('kingdom_exp', 0),
				'kingdom_wins' 					=> request_var('kingdom_wins', 0),
				'kingdom_losses' 				=> request_var('kingdom_losses', 0),
				'kingdom_pop' 					=> request_var('kingdom_pop', 0),
				'kingdom_net' 					=> request_var('kingdom_net', 0),
				'kingdom_food' 					=> request_var('kingdom_food', 0),
				'kingdom_wood' 					=> request_var('kingdom_wood', 0),
				'kingdom_iron' 					=> request_var('kingdom_iron', 0),
				'kingdom_gold' 					=> request_var('kingdom_gold', 0),
				'kingdom_land' 					=> request_var('kingdom_land', 0),	
				'kingdom_farms_lvl' 			=> request_var('kingdom_farms_lvl', 0),
				'kingdom_farms' 				=> request_var('kingdom_farms', 0),
				'kingdom_timber_mills_lvl' 		=> request_var('kingdom_timber_mills_lvl', 0),
				'kingdom_timber_mills' 			=> request_var('kingdom_timber_mills', 0),
				'kingdom_iron_mines_lvl'	 	=> request_var('kingdom_iron_mines_lvl', 0),
				'kingdom_iron_mines' 			=> request_var('kingdom_iron_mines', 0),
				'kingdom_gold_mines_lvl' 		=> request_var('kingdom_gold_mines_lvl', 0),
				'kingdom_gold_mines' 			=> request_var('kingdom_gold_mines', 0),
				'kingdom_towers_lvl' 			=> request_var('kingdom_towers_lvl', 0),
				'kingdom_towers' 				=> request_var('kingdom_towers', 0),
				'kingdom_granaries_lvl' 		=> request_var('kingdom_granaries_lvl', 0),
				'kingdom_granaries' 			=> request_var('kingdom_granaries', 0),
				'kingdom_woodsheds_lvl' 		=> request_var('kingdom_woodsheds_lvl', 0),
				'kingdom_woodsheds' 			=> request_var('kingdom_woodsheds', 0),
				'kingdom_ironpits_lvl' 			=> request_var('kingdom_ironpits_lvl', 0),
				'kingdom_ironpits' 				=> request_var('kingdom_ironpits', 0),
				'kingdom_vaults_lvl' 			=> request_var('kingdom_vaults_lvl', 0),
				'kingdom_vaults' 				=> request_var('kingdom_vaults', 0),
				'kingdom_villagers' 			=> request_var('kingdom_villagers', 0),
				'kingdom_spies' 				=> request_var('kingdom_spies', 0),
				'kingdom_soldiers' 				=> request_var('kingdom_soldiers', 0),
				'kingdom_macemen' 				=> request_var('kingdom_macemen', 0),
				'kingdom_axemen' 				=> request_var('kingdom_axemen', 0),
				'kingdom_spearmen' 				=> request_var('kingdom_spearmen', 0),
				'kingdom_swordsmen' 			=> request_var('kingdom_swordsmen', 0),
				'kingdom_legionnaires' 			=> request_var('kingdom_legionnaires', 0),
				'kingdom_knights' 				=> request_var('kingdom_knights', 0),
				'kingdom_slingers' 				=> request_var('kingdom_slingers', 0),
				'kingdom_bowmen' 				=> request_var('kingdom_bowmen', 0),
				'kingdom_long_bowmen' 			=> request_var('kingdom_long_bowmen', 0),
				'kingdom_crossbowmen' 			=> request_var('kingdom_crossbowmen', 0),
				'kingdom_light_sword_cavalry' 	=> request_var('kingdom_light_sword_cavalry', 0),
				'kingdom_heavy_sword_cavalry' 	=> request_var('kingdom_heavy_sword_cavalry', 0),
				'kingdom_light_archer_cavalry' 	=> request_var('kingdom_light_archer_cavalry', 0),
				'kingdom_heavy_archer_cavalry' 	=> request_var('kingdom_heavy_archer_cavalry', 0),
				'kingdom_paladin' 				=> request_var('kingdom_paladin', 0),
				'kingdom_dragon_knights' 		=> request_var('kingdom_dragon_knights', 0),
				'kingdom_rams' 					=> request_var('kingdom_rams', 0),
				'kingdom_catapults' 			=> request_var('kingdom_catapults', 0),
				'kingdom_heavy_catapults' 		=> request_var('kingdom_heavy_catapults', 0),
				'kingdom_ballistas' 			=> request_var('kingdom_ballistas', 0),
				'kingdom_trebuchets' 			=> request_var('kingdom_trebuchets', 0),
				'kingdom_chimeras' 				=> request_var('kingdom_chimeras', 0),
				'kingdom_hydras' 				=> request_var('kingdom_hydras', 0),
				'kingdom_basilisks' 			=> request_var('kingdom_basilisks', 0),
				'kingdom_wyverns' 				=> request_var('kingdom_wyverns', 0),
				'kingdom_leviathans' 			=> request_var('kingdom_leviathans', 0),
				'kingdom_dragons' 				=> request_var('kingdom_dragons', 0),		
				
				
			);
			
			$db->sql_query('UPDATE ' . AOD_KINGDOMS_TABLE .' SET ' . $db->sql_build_array('UPDATE', $sql_ary) . " WHERE user_id = $uid");
			$db->sql_return_on_error(false);					

			
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=4").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['KINGDOM_CONFIG_UPDATE'].$return_link);	
		}
		
		$kdata = fetch_kingdom_data($uid);
					
					
										
		$acp_control_data = '
		<input type="hidden" name="uid" value="'.$uid.'">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_4'].'</b></span></td>
			</tr>';
			
		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" width="90%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KINGDOM_NAME'].'</b></span></td>
				<td class="game_row3" align="center" width="10%"  style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_name" class="game_post" maxlength="32" value="'.$kdata['kingdom_name'].'"></td>
			</tr>';
		
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KINGDOM_RULER'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_ruler" class="game_post" maxlength="32" value="'.$kdata['kingdom_ruler'].'"></td>
			</tr>';
		
		switch($kdata['kingdom_status'])
		{
			case 1: // Frozen
				$kingdom_status_options = '<option value="1">'.$user->lang['STATUS_1'].'</option>';
				$kingdom_status_options .= '<option value="0">'.$user->lang['STATUS_0'].'</option>';
			break;
			
			default: // Active
				$kingdom_status_options = '<option value="0">'.$user->lang['STATUS_0'].'</option>';
				$kingdom_status_options .= '<option value="1">'.$user->lang['STATUS_1'].'</option>';
			break;
		} 
		
		$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KINGDOM_STATUS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><select name="kingdom_status" class="game_post" style="width:100%;">'.$kingdom_status_options.'</select></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>&nbsp;</b></span></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_level" class="game_post" maxlength="32" value="'.$kdata['kingdom_level'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['EXP'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_exp" class="game_post" maxlength="32" value="'.$kdata['kingdom_exp'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WINS'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_wins" class="game_post" maxlength="32" value="'.$kdata['kingdom_wins'].'"></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LOSSES'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_losses" class="game_post" maxlength="32" value="'.$kdata['kingdom_losses'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['POPULATION'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_pop" class="game_post" maxlength="32" value="'.$kdata['kingdom_pop'].'"></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['NETWORTH'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_net" class="game_post" maxlength="32" value="'.$kdata['kingdom_net'].'"></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['RESOURCES'].'</b></span></td>
			</tr>';			

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['FOOD'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_food" class="game_post" maxlength="32" value="'.$kdata['kingdom_food'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['WOOD'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_wood" class="game_post" maxlength="32" value="'.$kdata['kingdom_wood'].'"></td>
			</tr>';					

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['IRON'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_iron" class="game_post" maxlength="32" value="'.$kdata['kingdom_iron'].'"></td>
			</tr>';					

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['GOLD'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_gold" class="game_post" maxlength="32" value="'.$kdata['kingdom_gold'].'"></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LAND'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_land" class="game_post" maxlength="32" value="'.$kdata['kingdom_land'].'"></td>
			</tr>';

		$building = fetch_all_building_data();		
			
		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[1]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_farms" class="game_post" maxlength="32" value="'.$kdata['kingdom_farms'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_farms_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_farms_lvl'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[2]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_timber_mills" class="game_post" maxlength="32" value="'.$kdata['kingdom_timber_mills'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_timber_mills_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_timber_mills_lvl'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[3]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_iron_mines" class="game_post" maxlength="32" value="'.$kdata['kingdom_iron_mines'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_iron_mines_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_iron_mines_lvl'].'"></td>
			</tr>';						

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[4]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_gold_mines" class="game_post" maxlength="32" value="'.$kdata['kingdom_gold_mines'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_gold_mines_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_gold_mines_lvl'].'"></td>
			</tr>';			

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[5]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_towers" class="game_post" maxlength="32" value="'.$kdata['kingdom_towers'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_towers_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_towers_lvl'].'"></td>
			</tr>';						

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[6]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_granaries" class="game_post" maxlength="32" value="'.$kdata['kingdom_granaries'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_granaries_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_granaries_lvl'].'"></td>
			</tr>';				

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[7]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_woodsheds" class="game_post" maxlength="32" value="'.$kdata['kingdom_woodsheds'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_woodsheds_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_woodsheds_lvl'].'"></td>
			</tr>';							

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[8]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_ironpits" class="game_post" maxlength="32" value="'.$kdata['kingdom_ironpits'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_ironpits_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_ironpits_lvl'].'"></td>
			</tr>';							

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$building[9]['building_name'].'</b></span></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['OWN'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_vaults" class="game_post" maxlength="32" value="'.$kdata['kingdom_vaults'].'"></td>
			</tr>';					
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['LEVEL'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_vaults_lvl" class="game_post" maxlength="32" value="'.$kdata['kingdom_vaults_lvl'].'"></td>
			</tr>';							

		$acp_control_data .= '		
			<tr>
				<td colspan="2" class="game_header" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['UNITS'].'</b></span></td>
			</tr>';	
								
		$unit = fetch_all_unit_data();
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[1]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_villagers" class="game_post" maxlength="32" value="'.$kdata['kingdom_villagers'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[2]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_soldiers" class="game_post" maxlength="32" value="'.$kdata['kingdom_soldiers'].'"></td>
			</tr>';
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[3]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_spies" class="game_post" maxlength="32" value="'.$kdata['kingdom_spies'].'"></td>
			</tr>';			
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[4]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_macemen" class="game_post" maxlength="32" value="'.$kdata['kingdom_macemen'].'"></td>
			</tr>';				
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[5]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_axemen" class="game_post" maxlength="32" value="'.$kdata['kingdom_axemen'].'"></td>
			</tr>';				
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[6]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_spearmen" class="game_post" maxlength="32" value="'.$kdata['kingdom_spearmen'].'"></td>
			</tr>';				
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[7]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_swordsmen" class="game_post" maxlength="32" value="'.$kdata['kingdom_swordsmen'].'"></td>
			</tr>';				
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[8]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_legionnaires" class="game_post" maxlength="32" value="'.$kdata['kingdom_legionnaires'].'"></td>
			</tr>';				
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[9]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_knights" class="game_post" maxlength="32" value="'.$kdata['kingdom_knights'].'"></td>
			</tr>';	


		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[10]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_slingers" class="game_post" maxlength="32" value="'.$kdata['kingdom_slingers'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[11]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_bowmen" class="game_post" maxlength="32" value="'.$kdata['kingdom_bowmen'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[12]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_long_bowmen" class="game_post" maxlength="32" value="'.$kdata['kingdom_long_bowmen'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[13]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_crossbowmen" class="game_post" maxlength="32" value="'.$kdata['kingdom_crossbowmen'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[14]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_light_sword_cavalry" class="game_post" maxlength="32" value="'.$kdata['kingdom_light_sword_cavalry'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[15]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_heavy_sword_cavalry" class="game_post" maxlength="32" value="'.$kdata['kingdom_heavy_sword_cavalry'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[16]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_light_archer_cavalry" class="game_post" maxlength="32" value="'.$kdata['kingdom_light_archer_cavalry'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[17]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_heavy_archer_cavalry" class="game_post" maxlength="32" value="'.$kdata['kingdom_heavy_archer_cavalry'].'"></td>
			</tr>';			
			
		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[18]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_paladin" class="game_post" maxlength="32" value="'.$kdata['kingdom_paladin'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[19]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_dragon_knights" class="game_post" maxlength="32" value="'.$kdata['kingdom_dragon_knights'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[20]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_rams" class="game_post" maxlength="32" value="'.$kdata['kingdom_rams'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[21]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_catapults" class="game_post" maxlength="32" value="'.$kdata['kingdom_catapults'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[22]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_heavy_catapults" class="game_post" maxlength="32" value="'.$kdata['kingdom_heavy_catapults'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[23]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_ballistas" class="game_post" maxlength="32" value="'.$kdata['kingdom_ballistas'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[24]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_trebuchets" class="game_post" maxlength="32" value="'.$kdata['kingdom_trebuchets'].'"></td>
			</tr>';	

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[25]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_chimeras" class="game_post" maxlength="32" value="'.$kdata['kingdom_chimeras'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[26]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_hydras" class="game_post" maxlength="32" value="'.$kdata['kingdom_hydras'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[27]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_basilisks" class="game_post" maxlength="32" value="'.$kdata['kingdom_basilisks'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[28]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_wyverns" class="game_post" maxlength="32" value="'.$kdata['kingdom_wyverns'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[29]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_leviathans" class="game_post" maxlength="32" value="'.$kdata['kingdom_leviathans'].'"></td>
			</tr>';

		$acp_control_data .= '		
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$unit[30]['unit_name'].'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><input type="text" name="kingdom_dragons" class="game_post" maxlength="32" value="'.$kdata['kingdom_dragons'].'"></td>
			</tr>';			
																		
		$acp_control_data .= '
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['UPDATE'].'"></td>
			</tr>		
		</table>';
	}
	break;
	
	case 3:

			// Promote users to admin status
		if($cmd == $user->lang['PROMOTE_TO_ADMIN'])
		{
			$db->sql_query(
			"UPDATE " . AOD_KINGDOMS_TABLE ." SET 
			admin_access = 1
			WHERE user_id = $uid");
			$db->sql_return_on_error(false);	
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=3").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['USER_WAS_PROMOTED'].$return_link);	
		}
		
		// Demote users from admin status
		if($cmd == 'demote')
		{		
			$db->sql_query(
			"UPDATE " . AOD_KINGDOMS_TABLE ." SET 
			admin_access = 0
			WHERE user_id = $uid");
			$db->sql_return_on_error(false);	
			$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=3").'">'.$user->lang['GO_BACK_LINK'].'</a>';
			trigger_error($user->lang['USER_WAS_DEMOTED'].$return_link);	
		}
				
		$acp_control_data = '
		<input type="hidden" name="" value="">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_3'].'</b></span></td>
			</tr>
			<tr>
				<td colspan="2" class="game_row1" align="center"><br />';
					
					$player_option_list = build_player_option_list(FALSE);
					
					// List all the players
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['USER_LIST'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="right" width="25%" ><span class="stext"><b>'.$user->lang['USERS'].' :</b></span></td>
							<td class="game_row3" align="center" width="75%" ><select name="uid" class="game_post">'.$player_option_list.'</select></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['PROMOTE_TO_ADMIN'].'"></td>
						</tr>
					</table><br />';
					
					// Show the head admin
					$kdata = fetch_kingdom_data(2);			
					$cur_admin_list .= '
					<tr>
						<td class="game_row2" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$kdata['kingdom_ruler'].'</b></span></td>
						<td class="game_row2" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$kdata['kingdom_name'].'</b></span></td>
						<td class="game_row2" align="center" width="10%" style="border-bottom:solid thin #000000;"><span class="stext"><b>[ - ]</b></span></td>
					</tr>';		
					
					// List all the current admins			
					$sql = "SELECT * 
					FROM " . AOD_KINGDOMS_TABLE."
					WHERE admin_access = 1";
					$result = $db->sql_query($sql);
			
					while ($row = $db->sql_fetchrow($result))
					{
						$cur_admin_list .= '
						<tr>
							<td class="game_row2" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$row['kingdom_ruler'].'</b></span></td>
							<td class="game_row2" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$row['kingdom_name'].'</b></span></td>
							<td class="game_row2" align="center" width="10%" style="border-bottom:solid thin #000000;"><span class="stext"><b>[ <a href="admincp.php?menu=3&cmd=demote&uid='.$row['user_id'].'"><span class="stext"><b>x</b></span></a> ]</b></span></td>
						</tr>';
					}	
					$db->sql_freeresult($result);
		
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="3" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['ADMINS'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['USERNAME'].'</b></span></td>
							<td class="game_row3" align="center" width="45%" style="border-bottom:solid thin #000000; border-right:solid thin #000000;"><span class="stext"><b>'.$user->lang['KINGDOM'].'</b></span></td>
							<td class="game_row3" align="center" width="10%" style="border-bottom:solid thin #000000;"><span class="stext"><b>'.$user->lang['ACTION'].'</b></span></td>
						</tr>	
						'.$cur_admin_list.'	
					</table><br />';

								
		$acp_control_data .= '
				</td>
			</tr>				
		</table>';
		
	break;
		
	case 2:

		// Update Game Config
		if($cmd == $user->lang['UPDATE'])
		{
			if($land_cost_penalty > 99.99 || $land_cost_penalty < 1)
			{
				$error = TRUE;
				$error_msgs = $user->lang['ADMINCP_PENALTY_ERROR_1'];
			}

			if($unit_cost_penalty > 99.99 || $unit_cost_penalty < 1)
			{
				$error = TRUE;
				$error_msgs = $user->lang['ADMINCP_PENALTY_ERROR_2'];
			}
						
			if($bash_penalty > 99.99 || $bash_penalty < 1)
			{
				$error = TRUE;
				$error_msgs = $user->lang['ADMINCP_PENALTY_ERROR_3'];
			}
			
			if(!$error)
			{
				$aod_config_row = array(
					'cron_passwd' 				=> $cron_passwd,
					'land_gold' 				=> $land_gold,
					'sponsor_def_bonus' 		=> $sponsor_def_bonus,						
					'farms_income_min' 			=> $farms_income_min,
					'farms_income_max' 			=> $farms_income_max,
					'timber_mills_income_min' 	=> $timber_mills_income_min,
					'timber_mills_income_max' 	=> $timber_mills_income_max,
					'iron_mines_income_min' 	=> $iron_mines_income_min,
					'iron_mines_income_max' 	=> $iron_mines_income_max,
					'gold_mines_income_min' 	=> $gold_mines_income_min,
					'gold_mines_income_max' 	=> $gold_mines_income_max,
					'food_per_gold' 			=> $food_per_gold,
					'wood_per_gold' 			=> $wood_per_gold,
					'iron_per_gold' 			=> $iron_per_gold,
					'granaries_max' 			=> $granaries_max,
					'woodsheds_max' 			=> $woodsheds_max,
					'ironpits_max' 				=> $ironpits_max,
					'vaults_max' 				=> $vaults_max,
					'start_farms' 				=> $start_farms,
					'start_timbermills' 		=> $start_timbermills,
					'start_ironmines' 			=> $start_ironmines,
					'start_goldmines' 			=> $start_goldmines,
					'start_granaries' 			=> $start_granaries,
					'start_woodsheds' 			=> $start_woodsheds,
					'start_ironpits' 			=> $start_ironpits,
					'start_vaults' 				=> $start_vaults,
					'stamina_advantage' 		=> $stamina_advantage,
					'turns_advantage' 			=> $turns_advantage,
					'unitcost_advantage' 		=> $unitcost_advantage,
					'offdef_advantage' 			=> $offdef_advantage,
					'kingdoms_per_page' 		=> $kingdoms_per_page,
					'quests_per_page' 			=> $quests_per_page,
					'ranks_per_page' 			=> $ranks_per_page,
					'reports_per_page' 			=> $reports_per_page,
					'land_cost_penalty' 		=> $land_cost_penalty,
					'unit_cost_penalty' 		=> $unit_cost_penalty,
					'market_open' 				=> $market_open,
					'shop_open' 				=> $shop_open,
					'bash_penalty' 				=> $bash_penalty,
					'exp_for_bash'				=> $exp_for_bash,
					'levels_greater'			=> $levels_greater,
					'times_greater'				=> $times_greater,
					'land_greater'				=> $land_greater,
					'net_greater'				=> $net_greater,


					
					
				);
				
				foreach ($aod_config_row as $config_name => $config_value)
				{
					set_aod_config($config_name, $config_value);
				}
				
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=2").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['GAME_CONFIG_UPDATE'].$return_link);
			}	
		}
				
		$acp_control_data = '
		<input type="hidden" name="" value="">
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_2'].'</b></span></td>
			</tr>
			<tr>
				<td colspan="2" class="game_row1" align="center">';

					$cron_passwd = ($cron_passwd) ? $cron_passwd : $aod_config['cron_passwd'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['CRON_PASSWD_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['CRON_PASSWD'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="cron_passwd" class="game_post" maxlength="32" value="'.$cron_passwd.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_CRON_PASSWD'].'</b></span></td>
						</tr>
					</table><br />';


					$land_gold = ($land_gold) ? $land_gold : $aod_config['land_gold'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['LAND_COST_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['LAND_COST'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="land_gold" class="game_post" maxlength="32" value="'.$land_gold.'"></td>
						</tr>		
					</table><br />';

					$sponsor_def_bonus = ($sponsor_def_bonus) ? $sponsor_def_bonus : $aod_config['sponsor_def_bonus'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['SPONSOR_DEF_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['SPONSOR_DEF'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="sponsor_def_bonus" class="game_post" maxlength="32" value="'.$sponsor_def_bonus.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_SPONSOR_DEF'].'</b></span></td>
						</tr>
					</table><br />';

									
					$farms_income_min = ($farms_income_min) ? $farms_income_min : $aod_config['farms_income_min'];
					$farms_income_max = ($farms_income_max) ? $farms_income_max : $aod_config['farms_income_max'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['FARM_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MIN_FOOD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="farms_income_min" class="game_post" maxlength="32" value="'.$farms_income_min.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_FOOD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="farms_income_max" class="game_post" maxlength="32" value="'.$farms_income_max.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_INCOME'].'</b></span></td>
						</tr>
					</table><br />';
					
					$timber_mills_income_min = ($timber_mills_income_min) ? $timber_mills_income_min : $aod_config['timber_mills_income_min'];
					$timber_mills_income_max = ($timber_mills_income_max) ? $timber_mills_income_max : $aod_config['timber_mills_income_max'];
					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['TIMBERMILL_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MIN_WOOD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="timber_mills_income_min" class="game_post" maxlength="32" value="'.$timber_mills_income_min.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_WOOD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="timber_mills_income_max" class="game_post" maxlength="32" value="'.$timber_mills_income_max.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_INCOME'].'</b></span></td>
						</tr>
					</table><br />';
										
					$iron_mines_income_min = ($iron_mines_income_min) ? $iron_mines_income_min : $aod_config['iron_mines_income_min'];
					$iron_mines_income_max = ($iron_mines_income_max) ? $iron_mines_income_max : $aod_config['iron_mines_income_max'];
					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['IRONMINE_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MIN_IRON_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="iron_mines_income_min" class="game_post" maxlength="32" value="'.$iron_mines_income_min.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_IRON_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="iron_mines_income_max" class="game_post" maxlength="32" value="'.$iron_mines_income_max.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_INCOME'].'</b></span></td>
						</tr>
					</table><br />';
					
					$gold_mines_income_min = ($gold_mines_income_min) ? $gold_mines_income_min : $aod_config['gold_mines_income_min'];
					$gold_mines_income_max = ($gold_mines_income_max) ? $gold_mines_income_max : $aod_config['gold_mines_income_max'];
					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['GOLDMINE_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MIN_GOLD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="gold_mines_income_min" class="game_post" maxlength="32" value="'.$gold_mines_income_min.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_GOLD_INCOME'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="gold_mines_income_max" class="game_post" maxlength="32" value="'.$gold_mines_income_max.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_INCOME'].'</b></span></td>
						</tr>
					</table><br />';

					$food_per_gold = ($food_per_gold) ? $food_per_gold : $aod_config['food_per_gold'];
					$wood_per_gold = ($wood_per_gold) ? $wood_per_gold : $aod_config['wood_per_gold'];
					$iron_per_gold = ($iron_per_gold) ? $iron_per_gold : $aod_config['iron_per_gold'];
					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MARKET_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['FOOD_PER_GOLD'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="food_per_gold" class="game_post" maxlength="32" value="'.$food_per_gold.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['WOOD_PER_GOLD'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="wood_per_gold" class="game_post" maxlength="32" value="'.$wood_per_gold.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['IRON_PER_GOLD'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="iron_per_gold" class="game_post" maxlength="32" value="'.$iron_per_gold.'"></td>
						</tr>		
					</table><br />';					

					$granaries_max = ($granaries_max) ? $granaries_max : $aod_config['granaries_max'];
					$woodsheds_max = ($woodsheds_max) ? $woodsheds_max : $aod_config['woodsheds_max'];
					$ironpits_max = ($ironpits_maxv) ? $ironpits_max : $aod_config['ironpits_max'];
					$vaults_max = ($vaults_max) ? $vaults_max : $aod_config['vaults_max'];
					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MAXIMUM_BUILDING_STORAGE'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_FOOD_STORAGE_ACP'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="granaries_max" class="game_post" maxlength="32" value="'.$granaries_max.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_WOOD_STORAGE_ACP'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="woodsheds_max" class="game_post" maxlength="32" value="'.$woodsheds_max.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_IRON_STORAGE_ACP'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="ironpits_max" class="game_post" maxlength="32" value="'.$ironpits_max.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MAX_GOLD_STORAGE_ACP'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="vaults_max" class="game_post" maxlength="32" value="'.$vaults_max.'"></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_MAX_STORAGE'].'</b></span></td>
						</tr>								
					</table><br />';
										
					$start_farms = ($start_farms) ? $start_farms : $aod_config['start_farms'];
					$start_timbermills = ($start_timbermills) ? $start_timbermills : $aod_config['start_timbermills'];
					$start_ironmines = ($start_ironmines) ? $start_ironmines : $aod_config['start_ironmines'];
					$start_goldmines = ($start_goldmines) ? $start_goldmines : $aod_config['start_goldmines'];
					$start_granaries = ($start_granaries) ? $start_granaries : $aod_config['start_granaries'];
					$start_woodsheds = ($start_woodsheds) ? $start_woodsheds : $aod_config['start_woodsheds'];
					$start_ironpits = ($start_ironpits) ? $start_ironpits : $aod_config['start_ironpits'];
					$start_vaults = ($start_vaults) ? $start_vaults : $aod_config['start_vaults'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['STARTUP_BUILDINGS'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_1'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_farms" class="game_post" maxlength="32" value="'.$start_farms.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_2'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_timbermills" class="game_post" maxlength="32" value="'.$start_timbermills.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_3'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_ironmines" class="game_post" maxlength="32" value="'.$start_ironmines.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_4'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_goldmines" class="game_post" maxlength="32" value="'.$start_goldmines.'"></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_5'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_granaries" class="game_post" maxlength="32" value="'.$start_granaries.'"></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_6'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_woodsheds" class="game_post" maxlength="32" value="'.$start_woodsheds.'"></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_7'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_ironpits" class="game_post" maxlength="32" value="'.$start_ironpits.'"></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['STARTUP_BUILDING_8'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="start_vaults" class="game_post" maxlength="32" value="'.$start_vaults.'"></td>
						</tr>							
					</table><br />';
					
					$stamina_advantage = ($stamina_advantage) ? $stamina_advantage : $aod_config['stamina_advantage'];
					$turns_advantage = ($turns_advantage) ? $turns_advantage : $aod_config['turns_advantage'];
					$unitcost_advantage = ($unitcost_advantage) ? $unitcost_advantage : $aod_config['unitcost_advantage'];
					$offdef_advantage = ($offdef_advantage) ? $offdef_advantage : $aod_config['offdef_advantage'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['ADVANTAGE_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['ADVANTAGE_1'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="stamina_advantage" class="game_post" maxlength="32" value="'.$stamina_advantage.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['ADVANTAGE_2'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="turns_advantage" class="game_post" maxlength="32" value="'.$turns_advantage.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['ADVANTAGE_3'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="unitcost_advantage" class="game_post" maxlength="32" value="'.$unitcost_advantage.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['ADVANTAGE_4'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="offdef_advantage" class="game_post" maxlength="32" value="'.$offdef_advantage.'"></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_ADVANTAGES'].'</b></span></td>
						</tr>								
					</table><br />';
					
					$kingdoms_per_page = ($kingdoms_per_page) ? $kingdoms_per_page : $aod_config['kingdoms_per_page'];
					$quests_per_page = ($quests_per_page) ? $quests_per_page : $aod_config['quests_per_page'];
					$ranks_per_page = ($ranks_per_page) ? $ranks_per_page : $aod_config['ranks_per_page'];
					$reports_per_page = ($reports_per_page) ? $reports_per_page : $aod_config['reports_per_page'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['PER_PAGE_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PER_PAGE_1'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="kingdoms_per_page" class="game_post" maxlength="32" value="'.$kingdoms_per_page.'"></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PER_PAGE_2'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="quests_per_page" class="game_post" maxlength="32" value="'.$quests_per_page.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PER_PAGE_3'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="ranks_per_page" class="game_post" maxlength="32" value="'.$ranks_per_page.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PER_PAGE_4'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="reports_per_page" class="game_post" maxlength="32" value="'.$reports_per_page.'"></td>
						</tr>	
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_PER_PAGE'].'</b></span></td>
						</tr>											
					</table><br />';
	
					$land_cost_penalty = ($land_cost_penalty) ? $land_cost_penalty : $aod_config['land_cost_penalty'];
					$unit_cost_penalty = ($unit_cost_penalty) ? $unit_cost_penalty : $aod_config['unit_cost_penalty'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['PENALTY_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PENALTY_1'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="land_cost_penalty" class="game_post" maxlength="5" value="'.$land_cost_penalty.'"></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PENALTY_2'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="unit_cost_penalty" class="game_post" maxlength="5" value="'.$unit_cost_penalty.'"></td>
						</tr>		
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_PENALTY'].'</b></span></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXPLAIN_BASH_PENALTY'].'</b></span></td>
						</tr>												
					</table><br />';

					$market_open = ($market_open) ? $market_open : $aod_config['market_open'];
					$shop_open = ($shop_open) ? $shop_open : $aod_config['shop_open'];
					if($market_open == TRUE)
					{
						$market_selected = " SELECTED";
					}
					if($shop_open == TRUE)
					{
						$shop_selected = " SELECTED";
					}					
					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MARKET_SHOP_OPEN_CONFIG'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['MARKET'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" >
							<select name="market_open" class="game_post">
								<option value="0">'.$user->lang['CLOSED'].'</option>
								<option value="1" '.$market_selected.'>'.$user->lang['OPEN'].'</option>
							</select>
							</td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['SHOP'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" >
							<select name="shop_open" class="game_post">
								<option value="0" >'.$user->lang['CLOSED'].'</option>
								<option value="1" '.$shop_selected.'>'.$user->lang['OPEN'].'</option>
							</select>
							</td>
						</tr>		
					</table><br />';					

					$exp_for_bash = ($exp_for_bash) ? $exp_for_bash : $aod_config['exp_for_bash'];
					$times_greater = ($times_greater) ? $times_greater : $aod_config['times_greater'];
					$land_greater = ($land_greater) ? $land_greater : $aod_config['land_greater'];
					$net_greater = ($net_greater) ? $net_greater : $aod_config['net_greater'];
					$levels_greater = ($levels_greater) ? $levels_greater : $aod_config['levels_greater'];
					$bash_penalty = ($bash_penalty) ? $bash_penalty : $aod_config['bash_penalty'];

					$acp_control_data .= '
					<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
						<tr>
							<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['BATTLE_SETTINGS'].'</b></span></td>
						</tr>		
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['EXP_FOR_BASH'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="exp_for_bash" class="game_post" maxlength="2" value="'.$exp_for_bash.'"></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['EXP_FOR_BASH_EXPLAIN'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['TIMES_GREATER'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="times_greater" class="game_post" maxlength="2" value="'.$times_greater.'"></td>
						</tr>												
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['TIMES_GREATER_EXPLAIN'].'</b></span></td>
						</tr>	
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['LAND_GREATER'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="land_greater" class="game_post" maxlength="2" value="'.$land_greater.'"></td>
						</tr>												
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['LAND_GREATER_EXPLAIN'].'</b></span></td>
						</tr>
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['NET_GREATER'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="net_greater" class="game_post" maxlength="2" value="'.$net_greater.'"></td>
						</tr>												
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['NET_GREATER_EXPLAIN'].'</b></span></td>
						</tr>																																											
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['LEVELS_GREATER'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="levels_greater" class="game_post" maxlength="2" value="'.$levels_greater.'"></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['LEVELS_GREATER_EXPLAIN'].'</b></span></td>
						</tr>														
						<tr>
							<td class="game_row3" align="left" width="80%" ><span class="stext"><b>'.$user->lang['PENALTY_3'].'</b></span></td>
							<td class="game_row3" align="center" width="20%" ><input type="text" name="bash_penalty" class="game_post" maxlength="2" value="'.$bash_penalty.'"></td>
						</tr>
						<tr>
							<td colspan="2" class="game_row2" align="left"><span class="ntext"><b>'.$user->lang['BASH_PENALTY_EXPLAIN'].'</b></span></td>
						</tr>								
					</table><br />';
																					
		$acp_control_data .= '
				</td>
			</tr>						
			<tr>
				<td colspan="2" class="game_header" align="center"><input type="submit" name="cmd" class="game_post" value="'.$user->lang['UPDATE'].'"></td>
			</tr>		
		</table>';
	break;
	
	default: 

		// Post Game News
		if($cmd == $user->lang['POST'])
		{
			if(isset($news))
			{
				post_game_news($news,$user_id,$date);
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=1").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['GAME_NEWS_POST_SUCCESSFUL'].$return_link);
				
			}
		}
		
		// Delete Game News
		if($cmd == 'delnews')
		{
			if(isset($nid))
			{
				delete_game_news($nid);
				$return_link = '<br><br><a href="'.append_sid("{$phpbb_root_path}games/aod/admincp.$phpEx?menu=1").'">'.$user->lang['GO_BACK_LINK'].'</a>';
				trigger_error($user->lang['GAME_NEWS_DELETE_SUCCESSFUL'].$return_link);
			}
		}
		
		$acp_control_data = '<br />
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="2" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['MENU_1'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row2" align="right" valign="top" width="15%"><span class="ntext"><b>'.$user->lang['NEWS'].' :&nbsp;</b></span></td>
				<td class="game_row2" align="center" valign="top" width="85%"><textarea rows="8" name="news" style="width:96%;" class="game_post"></textarea></td>
			</tr>	
			<tr>
				<td class="game_row2" align="right" valign="top"><span class="ntext"><b>&nbsp;</b></span></td>
				<td class="game_row2" align="right" valign="top" style="padding-right:4px;"><input type="submit" class="game_post" name="cmd" value="'.$user->lang['POST'].'"></td>
			</tr>					
		</table>';

		$acp_control_data .= '<br />
		<table border="0" cellspacing="0" cellpadding="4" align="center" width="99%" class="game_panel">
			<tr>
				<td colspan="10" class="game_header" align="center"><span class="ntext"><b>'.$user->lang['NEWS_ARCHIVES'].'</b></span></td>
			</tr>
			<tr>
				<td class="game_row3" align="center" valign="top" width="90%" style="border-bottom:solid thin #000000;border-right:solid thin #000000;"><span class="ntext"><b>'.$user->lang['NEWS'].'</b></span></td>
				<td class="game_row3" align="center" valign="top" width="10%" style="border-bottom:solid thin #000000;"><span class="ntext"><b>'.$user->lang['ACTION'].'</b></span></td>
			</tr>';
			

		// News
		$sql = 'SELECT * FROM ' . AOD_NEWS_TABLE . ' ORDER BY id DESC LIMIT 25';
		$result = $db->sql_query($sql);
		while ($row = $db->sql_fetchrow($result))
		{
			$nid = $row['id'];
			$news_post = $row['news'];
			$news_post = str_replace("\n", "<br />", $news_post);

			$acp_control_data .= '
			<tr>
				<td class="game_row2" align="left" style="border-bottom:solid thin #000000;border-right:solid thin #000000;"><span class="stext"><b>'.$row['date'].'<br />'.$news_post.'</b></span></td>
				<td class="game_row3" align="center" style="border-bottom:solid thin #000000;"><span class="stext"><b>[<a href="admincp.php?mode=1&cmd=delnews&nid='.$nid.'" class="stext">x</a>]</b></span></td>
			</tr>';
		}
		$db->sql_freeresult($result);

		$acp_control_data .= '
		</table>';
	break;
}

// Build ACP Menu
$arrow_img = '<img src="'.$phpbb_root_path.'games/images/arrow.png" border="0" width="9">&nbsp;';

$acp_menu = '<a href="admincp.php?menu=9" class="stext">'.$arrow_img.$user->lang['MENU_9'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=1" class="stext">'.$arrow_img.$user->lang['MENU_1'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=2" class="stext">'.$arrow_img.$user->lang['MENU_2'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=3" class="stext">'.$arrow_img.$user->lang['MENU_3'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=4" class="stext">'.$arrow_img.$user->lang['MENU_4'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=5" class="stext">'.$arrow_img.$user->lang['MENU_5'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=6" class="stext">'.$arrow_img.$user->lang['MENU_6'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=7" class="stext">'.$arrow_img.$user->lang['MENU_7'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=8" class="stext">'.$arrow_img.$user->lang['MENU_8'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=10" class="stext">'.$arrow_img.$user->lang['MENU_10'].'</a><br />';
$acp_menu .= '<a href="admincp.php?menu=11" class="stext">'.$arrow_img.$user->lang['MENU_11'].'</a><br />';


// Display an error messages to the user
if($error_msgs){
	$error_msgs = '<span class="errormsg"><b>'.$error_msgs.'</b></span><br />';
}

include($phpbb_root_path . 'games/aod/includes/page_header.' . $phpEx);

$template->assign_vars(array(
	'MENU'					=> $acp_menu,
	'CONTROL_DATA'			=> $acp_control_data,
	)
);

// Output page
page_header($game_name.' - '.$user->lang['ADMIN_CP']);

$template->set_filenames(array(
	'body' => $templates_path.'admin_body.html')
);

page_footer();
?>